Dockerfile : construction possible sans BuildKit
Les montages de cache (RUN --mount) exigent BuildKit, que l'ancien docker-compose n'active pas. On s'en passe : la compilation n'est plus mise en cache entre deux constructions, mais l'image se construit partout. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
906efff80f
commit
2de9def765
|
|
@ -2,13 +2,11 @@
|
||||||
FROM rust:1-bookworm AS build
|
FROM rust:1-bookworm AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
# Pas de montage de cache : l'image doit aussi se construire sans BuildKit (ancien docker-compose).
|
||||||
--mount=type=cache,target=/src/target \
|
RUN cargo build --release --locked -p show-me-server
|
||||||
cargo build --release --locked -p show-me-server \
|
|
||||||
&& cp target/release/show-me-server /show-me-server
|
|
||||||
|
|
||||||
FROM gcr.io/distroless/cc-debian12:nonroot
|
FROM gcr.io/distroless/cc-debian12:nonroot
|
||||||
COPY --from=build /show-me-server /usr/local/bin/show-me-server
|
COPY --from=build /src/target/release/show-me-server /usr/local/bin/show-me-server
|
||||||
EXPOSE 7878
|
EXPOSE 7878
|
||||||
ENTRYPOINT ["/usr/local/bin/show-me-server"]
|
ENTRYPOINT ["/usr/local/bin/show-me-server"]
|
||||||
CMD ["--listen", "0.0.0.0:7878"]
|
CMD ["--listen", "0.0.0.0:7878"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue