Last active
April 30, 2023 04:19
-
-
Save ento/641ad9dd18db0fabd4fca1a3dfd78efb to your computer and use it in GitHub Desktop.
Revisions
-
ento revised this gist
Apr 30, 2023 . No changes.There are no files selected for viewing
-
ento created this gist
Apr 30, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ FROM nixos/nix:latest AS builder RUN nix-env --install jq COPY . /tmp/build WORKDIR /tmp/build RUN drvpath=$(nix --extra-experimental-features "nix-command flakes" derivation show | jq -r 'to_entries[0] | .key') \ && echo $drvpath is the path \ && closure=$(nix-store --query --requisites $drvpath | grep -v -F $drvpath) \ && nix-store -r $closure RUN nix \ --extra-experimental-features "nix-command flakes" \ --option filter-syscalls false \ 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 /tmp/build/result /app CMD ["/app/bin/app"]