build(backend): one shared Dockerfile with cargo cache mounts, sequential compose build, stripped release binaries
All four services now share one builder stage (dependencies compile once per deploy, not once per service). BuildKit cache mounts keep the cargo registry and target/ between deploys: a one-line change rebuilds in ~16 s instead of recompiling the whole dependency tree.
This commit is contained in:
parent
cc33b6e4fc
commit
b0ee4ab317
8 changed files with 70 additions and 86 deletions
|
|
@ -1,20 +0,0 @@
|
|||
# Build context must be backend/ (the workspace root).
|
||||
FROM rust:1-trixie AS builder
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
protobuf-compiler pkg-config libssl-dev ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /build
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY common ./common
|
||||
COPY accounts-service ./accounts-service
|
||||
COPY gateway ./gateway
|
||||
COPY configs-service ./configs-service
|
||||
COPY chat-service ./chat-service
|
||||
RUN cargo build --release -p chat-service
|
||||
|
||||
FROM debian:trixie-slim
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates libssl3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=builder /build/target/release/chat-service /usr/local/bin/chat-service
|
||||
ENTRYPOINT ["/usr/local/bin/chat-service"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue