use alpine base for final image

This commit is contained in:
Adithya 2024-01-05 18:38:26 +05:30
parent f7a04b7a85
commit 5ed5cb6dde
Signed by: adtya
GPG key ID: 48FC9915FFD326D0

View file

@ -1,10 +1,19 @@
FROM nixos/nix:latest FROM nixos/nix:latest AS builder
WORKDIR /app WORKDIR /build
COPY . . COPY . .
RUN nix \ RUN nix \
--extra-experimental-features "nix-command flakes" \ --extra-experimental-features "nix-command flakes" \
build .#app build .#app
CMD [ "/app/result/bin/app" ] RUN mkdir -p /tmp/nix-store-closure
RUN cp -ra $(nix-store -qR result/) /tmp/nix-store-closure
FROM alpine:latest
WORKDIR /app
COPY --from=builder /tmp/nix-store-closure /nix/store
COPY --from=builder /build/result /app
CMD [ "/app/bin/app" ]