diff --git a/Dockerfile b/Dockerfile index f6b7e8d1..9bda5d7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,26 @@ FROM rust:1.74 as build +ENV DEBIAN_FRONTEND=noninteractive +RUN --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + rm -f /etc/apt/apt.conf.d/docker-clean \ + && apt-get update \ + && apt-get -y --no-install-recommends install musl-tools=1.2.3-1 + ENV CARGO_BUILD_TARGET=x86_64-unknown-linux-musl \ - DEBIAN_FRONTEND=noninteractive \ - PKG_CONFIG_ALLOW_CROSS=1 + PKG_CONFIG_ALLOW_CROSS=1 WORKDIR /app COPY . . RUN --mount=type=cache,target=/app/target \ - --mount=type=cache,target=/usr/local/cargo/registry \ - --mount=type=cache,target=/usr/local/cargo/git \ - --mount=type=cache,target=/usr/local/rustup \ - apt-get update \ - && apt-get -y --no-install-recommends install musl-tools \ - && rustup install stable \ + --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=cache,target=/usr/local/cargo/git \ + --mount=type=cache,target=/usr/local/rustup \ + rustup install stable \ && rustup target add ${CARGO_BUILD_TARGET} \ - && cargo build --package serve --release \ + && cargo build --package serve --release \ && mkdir -p /build \ && cp /app/target/${CARGO_BUILD_TARGET}/release/serve /build/ \ && strip /build/serve