Skip to content

Commit

Permalink
allow building docker images from nix
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaykarle committed Oct 17, 2024
1 parent fa754ea commit dfcab61
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,6 @@ cython_debug/
.idea/

.direnv/
file_uploads/
file_uploads/
# nix build results for docker and other packages
result
12 changes: 11 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,18 @@
(final: _: { myapp = final.callPackage myapp { }; })
];
};
# build docker using nix to have smaller images. Inspiration from
# https://lucabrunox.github.io/2016/04/cheap-docker-images-with-nix_15.html
buildImage = pkgs.dockerTools.buildLayeredImage {
name = "pii";
tag = "latest";
created = "now";
config.Entrypoint = [ "${pkgs.myapp}/bin/cli" ];
};
in
{
packages.default = pkgs.myapp;
packages.dockerImage = buildImage;

apps.default = {
type = "app";
Expand All @@ -79,8 +88,9 @@
default = pkgs.mkShell {
inputsFrom = [ pkgs.myapp ];
packages = [
pkgs.vault
pkgs.docker
pkgs.jq
pkgs.vault
];
};

Expand Down

0 comments on commit dfcab61

Please sign in to comment.