From 6ae9172ea1af129f0e068a5b689c4a636f7ae9fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 6 Aug 2025 16:32:01 +0200 Subject: [PATCH] Build on Alpine --- Dockerfile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index bb8956d83..d8eac7bcd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,11 +8,12 @@ COPY web/ . RUN pnpm run generate-translation-types RUN pnpm build -FROM rust:1.85.1 AS chef +FROM rust:1-alpine AS chef WORKDIR /build # install & cache necessary components +RUN apk add musl-dev openssl-dev RUN cargo install cargo-chef RUN rustup component add rustfmt @@ -32,7 +33,7 @@ RUN cargo chef cook --release --recipe-path recipe.json # build project COPY --from=web /app/dist ./web/dist COPY web/src/shared/images/svg ./web/src/shared/images/svg -RUN apt-get update && apt-get -y install protobuf-compiler libprotobuf-dev +RUN apk add openssl-libs-static protoc protobuf-dev COPY Cargo.toml Cargo.lock ./ # for vergen COPY .git .git @@ -43,10 +44,8 @@ COPY migrations migrations RUN cargo install --locked --bin defguard --path ./crates/defguard --root /build # run -FROM debian:bookworm-slim -RUN apt-get update -y && \ - apt-get install --no-install-recommends -y ca-certificates libssl-dev && \ - rm -rf /var/lib/apt/lists/* +FROM alpine:3 +RUN apk add ca-certificates WORKDIR /app COPY --from=builder /build/bin/defguard . ENTRYPOINT ["./defguard"]