diff --git a/docker/natter/Dockerfile b/docker/natter/Dockerfile index 1d9a5d7..d9a9fb8 100644 --- a/docker/natter/Dockerfile +++ b/docker/natter/Dockerfile @@ -1,4 +1,6 @@ -FROM rustlang/rust:nightly-alpine3.19 AS builder +ARG ALPINE_VERSION="3.20" + +FROM rustlang/rust:nightly-alpine$ALPINE_VERSION AS builder RUN apk add --no-cache musl-dev @@ -6,8 +8,8 @@ RUN mkdir /root/natter WORKDIR /root/natter COPY . . # TODO: Add static build, which currently errors due to proc_macro. RUSTFLAGS="-C target-feature=+crt-static" -RUN CARGO_TARGET_DIR=/target cargo build --profile release-lto +RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked CARGO_TARGET_DIR=/target cargo build --profile release-lto -FROM alpine:3.19 AS runner +FROM alpine:$ALPINE_VERSION AS runner COPY --from=builder /target/release-lto/natter /usr/bin/ diff --git a/docker/natter_development/Dockerfile b/docker/natter_development/Dockerfile index 8a07667..66f9bc2 100644 --- a/docker/natter_development/Dockerfile +++ b/docker/natter_development/Dockerfile @@ -1,11 +1,13 @@ -FROM rustlang/rust:nightly-alpine3.19 AS builder +ARG ALPINE_VERSION="3.20" + +FROM rustlang/rust:nightly-alpine$ALPINE_VERSION AS builder RUN apk add --no-cache musl-dev -RUN cargo install --locked --no-default-features --features ci-autoclean cargo-cache +RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked cargo install --locked --no-default-features --features ci-autoclean cargo-cache RUN rustup component add rustfmt RUN rustup component add clippy FROM builder AS javascript RUN apk add --no-cache npm -RUN npm install --global prettier@3.1.0 +RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/npmcache,sharing=locked npm set cache /npmcache && npm install --global prettier@3.1.0