Skip to content

Commit

Permalink
only cache the registry
Browse files Browse the repository at this point in the history
  • Loading branch information
randomairborne committed Jan 15, 2024
1 parent ad40fc7 commit 0436a56
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,28 @@ RUN echo $PATH

RUN cargo version

FROM alpine AS compressor

RUN apk add zstd brotli gzip

COPY /assets/ /assets/

RUN --mount=type=cache,target=/assets/ find /assets/ -type f -exec gzip -k9 '{}' \; -exec brotli -k9 '{}' \; -exec zstd -qk19 '{}' \;

FROM rust:alpine AS builder

WORKDIR /build
COPY . .

RUN apk add musl-dev

RUN echo $PATH

RUN cargo version

RUN \
--mount=type=cache,target=/build/target/ \
--mount=type=cache,target=/usr/local/cargo/ \
--mount=type=cache,target=/usr/local/cargo/registry/ \
cargo build --release && cp /build/target/release/mcping /build/mcping

FROM alpine
Expand All @@ -33,3 +52,16 @@ EXPOSE 8080
ENV ASSET_DIR="/var/www/mcping/"

ENTRYPOINT "/usr/bin/mcping"


FROM alpine

WORKDIR /

COPY --from=builder /build/mcping /usr/bin/mcping
COPY --from=compressor /assets/ /var/www/mcping/

EXPOSE 8080
ENV ASSET_DIR="/var/www/mcping/"

ENTRYPOINT "/usr/bin/mcping"

0 comments on commit 0436a56

Please sign in to comment.