Strip build dependencies from docker builds
Diff
Dockerfile | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
@@ -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"]