From 0e73c1a3d603c68fc59cb7adfecc08a95695cd72 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Mon, 06 Jan 2025 22:49:06 +0700 Subject: [PATCH] Strip build dependencies from docker builds --- Dockerfile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1e45ea6..55810b6 100644 --- a/Dockerfile +++ a/Dockerfile @@ -1,11 +1,16 @@ -FROM nixos/nix:2.24.9 AS builder +FROM nixos/nix:latest AS builder -RUN nix-channel --update -RUN echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf - WORKDIR /app COPY . . + +RUN nix --extra-experimental-features "nix-command flakes" --accept-flake-config build .# +RUN mkdir /tmp/nix-store-closure +RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure -RUN nix build .# +FROM scratch + +WORKDIR /app +COPY --from=builder /tmp/nix-store-closure /nix/store +COPY --from=builder /app/result /app -CMD ["/app/result/bin/rgit"] +ENTRYPOINT ["/app/bin/rgit"] -- rgit 0.1.4