Skip to content

Commit dab0c49

Browse files
committed
fix: docker config
1 parent 35cef7b commit dab0c49

File tree

4 files changed

+39
-20
lines changed

4 files changed

+39
-20
lines changed

Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ COPY . .
2020
RUN cargo build --release --target x86_64-unknown-linux-musl --bin cli
2121

2222
FROM scratch AS prod
23+
WORKDIR /user
24+
COPY config/00-default.toml 00-default.toml
2325
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/cli /usr/local/bin/rust-server
24-
CMD ["/usr/local/bin/rust-server"]
26+
ENTRYPOINT ["/usr/local/bin/rust-server", "--config-path=*.toml"]
2527

26-
FROM prod AS dev
28+
FROM alpine AS dev
2729
WORKDIR /user
30+
COPY config/00-default.toml 00-default.toml
31+
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/cli /usr/local/bin/rust-server
2832
COPY --from=bunyan /root/.cargo/bin/bunyan /usr/local/bin/
29-
CMD ["/usr/local/bin/rust-server | bunyan"]
33+
ENTRYPOINT ["/bin/sh"]
34+
CMD ["-c", "/usr/local/bin/rust-server --config-path=*.toml | bunyan"]

config/default.toml renamed to config/00-default.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ exporter_endpoint = "http://localhost:7281"
44
[db]
55
[[inmemory]]
66

7-
[[pg]]
8-
user = 'postgres'
9-
password = 'postgres'
10-
host = '127.0.0.1'
11-
port = 5432
12-
dbname = 'rust_template_db'
13-
pool.max_size = 16
14-
157
[server]
168
url = "0.0.0.0"
179
port = 8000

deploy/docker/01-custom.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
service_name = "rust-api-server-docker"
2+
exporter_endpoint = "http://quickwit:7281"
3+
4+
[server]
5+
url = "0.0.0.0"
6+
port = 8888
7+
8+
[log]
9+
level = "info"
10+
11+
[db.pg]
12+
url = "postgres://postgres:changeme@postgres:5432/postgres"
13+
max_size = 10

deploy/docker/docker-compose.yaml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
version: "3.3"
1+
version: "3.8"
22
networks:
33
rust-api-server:
4-
name: "rust-api-server-local"
4+
name: "rust-api-server-docker"
55
services:
66
quickwit:
77
image: quickwit/quickwit:latest
88
command: run
99
restart: always
1010
environment:
11-
QW_ENABLE_OTLP_ENDPOINT: 'true'
12-
QW_ENABLE_JAEGER_ENDPOINT: 'true'
11+
QW_ENABLE_OTLP_ENDPOINT: "true"
12+
QW_ENABLE_JAEGER_ENDPOINT: "true"
1313
ports:
14-
- '7280:7280'
15-
- '7281:7281'
14+
- "7280:7280"
15+
- "7281:7281"
1616
jaeger:
1717
image: jaegertracing/jaeger-query:latest
1818
restart: always
1919
depends_on:
2020
- quickwit
2121
environment:
22-
SPAN_STORAGE_TYPE: 'grpc-plugin'
23-
GRPC_STORAGE_SERVER: 'quickwit:7281'
22+
SPAN_STORAGE_TYPE: "grpc-plugin"
23+
GRPC_STORAGE_SERVER: "quickwit:7281"
2424
ports:
25-
- '16686:16686'
25+
- "16686:16686"
2626
postgres:
2727
image: postgres
2828
environment:
@@ -33,5 +33,14 @@ services:
3333
- postgres:/data/postgres
3434
ports:
3535
- "5432:5432"
36+
server:
37+
image: rust-server
38+
build:
39+
context: ../..
40+
target: dev
41+
ports:
42+
- "8888:8888"
43+
volumes:
44+
- ./01-custom.toml:/user/01-custom.toml:ro
3645
volumes:
3746
postgres:

0 commit comments

Comments
 (0)