Skip to content

Commit 609762c

Browse files
committed
fix: dockerfile
1 parent 5309043 commit 609762c

File tree

3 files changed

+25
-35
lines changed

3 files changed

+25
-35
lines changed

Cargo.lock

Lines changed: 0 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,30 @@ COPY . .
2020
RUN cargo build --release --all
2121
RUN mv target/${CARGO_BUILD_TARGET}/release /out
2222

23-
FROM alpine AS dev
23+
FROM alpine AS public-dev
2424
WORKDIR /user
2525
COPY src/public/config/00-default.toml 00-default.toml
26-
COPY --from=builder /out/cli /usr/local/bin/rust-server
26+
COPY --from=builder /out/cli /usr/local/bin/rust-api-server
2727
COPY --from=bunyan /root/.cargo/bin/bunyan /usr/local/bin/
2828
ENTRYPOINT ["/bin/sh"]
29-
CMD ["-c", "/usr/local/bin/rust-server --config-path=*.toml | bunyan"]
29+
CMD ["-c", "/usr/local/bin/rust-api-server --config-path=*.toml | bunyan"]
3030

31-
FROM alpine AS dev
31+
FROM alpine AS gpt-dev
3232
WORKDIR /user
33-
COPY src/public/config/00-default.toml 00-default.toml
34-
COPY --from=builder /out/cli /usr/local/bin/rust-server
33+
COPY src/gpt_answer_server/config/00-default.toml 00-default.toml
34+
COPY --from=builder /out/gpt_answer_server /usr/local/bin/rust-grpc-server
3535
COPY --from=bunyan /root/.cargo/bin/bunyan /usr/local/bin/
3636
ENTRYPOINT ["/bin/sh"]
37-
CMD ["-c", "/usr/local/bin/rust-server --config-path=*.toml | bunyan"]
37+
CMD ["-c", "/usr/local/bin/rust-grpc-server --config-path=*.toml | bunyan"]
3838

39-
FROM scratch AS prod
39+
FROM scratch AS public-prod
4040
WORKDIR /user
4141
COPY src/public/config/00-default.toml 00-default.toml
42-
COPY --from=builder /out/cli /usr/local/bin/rust-server
43-
ENTRYPOINT ["/usr/local/bin/rust-server", "--config-path=*.toml"]
42+
COPY --from=builder /out/cli /usr/local/bin/rust-api-server
43+
ENTRYPOINT ["/usr/local/bin/rust-api-server", "--config-path=*.toml"]
4444

45-
FROM scratch AS prod
45+
FROM scratch AS gpt-prod
4646
WORKDIR /user
47-
COPY src/public/config/00-default.toml 00-default.toml
48-
COPY --from=builder /out/cli /usr/local/bin/rust-server
49-
ENTRYPOINT ["/usr/local/bin/rust-server", "--config-path=*.toml"]
47+
COPY src/gpt_answer_server/config/00-default.toml 00-default.toml
48+
COPY --from=builder /out/gpt_answer_server /usr/local/bin/rust-grpc-server
49+
ENTRYPOINT ["/usr/local/bin/rust-grpc-server", "--config-path=*.toml"]

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ POSTGRES_DIR="./src/adapter/src/repositories/postgres"
22
DATABASE_URL="postgres://postgres:changeme@127.0.0.1:5432/postgres"
33

44
PKG_NAME=rust-api-server
5+
PKG_NAME_GRPC=rust-grpc-server
56
BUILD_VERSION=$(shell git describe --long)
67
BUILD_RELEASE=$(shell git describe --tags --abbrev=0)
78

8-
99
lint:
1010
cargo clippy --fix --allow-dirty --allow-staged
1111

@@ -26,16 +26,23 @@ migrate-redo:
2626

2727
build:
2828
PKG_NAME=rust-api-server
29+
PKG_NAME_GRPC=rust-grpc-server
2930
BUILD_VERSION=$(shell git describe --long)
3031
BUILD_RELEASE=$(shell git describe --tags --abbrev=0)
3132
BUILDKIT_PROGRESS=plain
3233
DOCKER_BUILDKIT=1
3334
docker build -t $(PKG_NAME):$(BUILD_VERSION) --target=public-prod .
34-
docker build -t $(PKG_NAME):$(BUILD_VERSION) --target=gpt-prod .
35+
docker build -t $(PKG_NAME_GRPC):$(BUILD_VERSION) --target=gpt-prod .
3536

3637
build-dev:
3738
BUILDKIT_PROGRESS=plain DOCKER_BUILDKIT=1 docker build -t $(PKG_NAME):$(BUILD_VERSION) --target=public-dev .
38-
BUILDKIT_PROGRESS=plain DOCKER_BUILDKIT=1 docker build -t $(PKG_NAME):$(BUILD_VERSION) --target=gpt-dev .
39+
BUILDKIT_PROGRESS=plain DOCKER_BUILDKIT=1 docker build -t $(PKG_NAME_GRPC):$(BUILD_VERSION) --target=gpt-dev .
3940

4041
profiling-public:
41-
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root -- -c ./src/public/config/* -c ./deploy/local/custom.toml
42+
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root -- -c ./src/public/config/* -c ./deploy/local/custom.toml
43+
44+
run-api-server:
45+
docker run -it --rm $(PKG_NAME):$(BUILD_VERSION)
46+
47+
run-grpc-server:
48+
docker run -it --rm $(PKG_NAME_GRPC):$(BUILD_VERSION)

0 commit comments

Comments
 (0)