From 55d34f36503cfa6d100a3a53da0c5937dd62d848 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Fri, 5 Jan 2024 18:28:08 +0530 Subject: [PATCH] change final image to use debian base --- Dockerfile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4ac8b9c..0cedcf0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,19 @@ -FROM nixos/nix:latest -WORKDIR /app +FROM nixos/nix:latest AS builder +WORKDIR /build COPY . . RUN nix \ --extra-experimental-features "nix-command flakes" \ 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 debian:stable-slim +WORKDIR /app + +COPY --from=builder /tmp/nix-store-closure /nix/store +COPY --from=builder /build/result /app + +CMD [ "/app/bin/app" ]