From e9775215681a63724ea2ade0a7b083144ba050a2 Mon Sep 17 00:00:00 2001 From: Tristan Perrin Date: Wed, 16 Oct 2024 19:33:49 +0200 Subject: [PATCH] feat : make dockerfile uses cargo cache --- Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f1fb3ddd9..d1045efcc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,12 +3,16 @@ ENV RUSTFLAGS="-C target-feature=-crt-static -C target-cpu=native" RUN apk add --no-cache musl-dev WORKDIR /pumpkin COPY . /pumpkin -RUN cargo build --release -RUN strip target/release/pumpkin +RUN --mount=type=cache,sharing=private,target=/pumpkin/target \ + --mount=type=cache,target=/usr/local/cargo/git/db \ + --mount=type=cache,target=/usr/local/cargo/registry/ \ + cargo build --release && cp target/release/pumpkin ./pumpkin.release +RUN strip pumpkin.release FROM alpine:3.20 WORKDIR /pumpkin RUN apk add --no-cache libgcc -COPY --from=builder /pumpkin/target/release/pumpkin /pumpkin/pumpkin +COPY --from=builder /pumpkin/pumpkin.release /pumpkin/pumpkin +ENV RUST_BACKTRACE=full EXPOSE 25565 ENTRYPOINT ["/pumpkin/pumpkin"]