🏡 index : ~doyle/rgit.git

author Jordan Doyle <jordan@doyle.la> 2025-01-06 22:49:06.0 +07:00:00
committer Jordan Doyle <jordan@doyle.la> 2025-01-06 22:53:50.0 +07:00:00
commit
0e73c1a3d603c68fc59cb7adfecc08a95695cd72 [patch]
tree
c5b61bd6f9eedbc232fb0c618d6236cb8ccae9ba
parent
a72dd066cc1bddd14054086dfd9c1f1b3de8e540
download
0e73c1a3d603c68fc59cb7adfecc08a95695cd72.tar.gz

Strip build dependencies from docker builds



Diff

 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"]