Skip to content

Commit

Permalink
Merge pull request #133 from IronMine/use_cargo_cache_in_dockerfile
Browse files Browse the repository at this point in the history
feat : make dockerfile uses cargo cache
  • Loading branch information
Snowiiii authored Oct 16, 2024
2 parents 2eae5b9 + e977521 commit 00ba487
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit 00ba487

Please sign in to comment.