Skip to content

Commit

Permalink
Strip build dependencies from docker builds
Browse files Browse the repository at this point in the history
  • Loading branch information
w4 committed Jan 6, 2025
1 parent a72dd06 commit 0e73c1a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
FROM nixos/nix:2.24.9 AS builder

RUN nix-channel --update
RUN echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
FROM nixos/nix:latest AS builder

WORKDIR /app
COPY . .

RUN nix build .#
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

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

0 comments on commit 0e73c1a

Please sign in to comment.