feat(14): nix derivation to build docker image

This commit is contained in:
efim 2023-07-03 06:23:46 +00:00
parent 80af2e0fd0
commit f6d8a1de8d
2 changed files with 18 additions and 0 deletions

View File

@ -81,7 +81,24 @@ let
};
};
};
image = pkgs.dockerTools.buildLayeredImage {
name = pname;
tag = "latest";
created = "now";
config = {
Cmd = [ "${pkgs.jdk}/bin/java" "-jar" "${package}/bin/${pname}.jar" "--host" "0.0.0.0" ];
ExposedPorts = {
"8080/tcp" = {};
};
};
};
# image = pkgs.dockerTools.buildLayeredImage { # so, wow, this works
# name = "hello2";
# tag = "latest";
# config.Cmd = [ "${pkgs.hello}/bin/hello" ];
# };
in {
package = package;
module = module;
image = image;
}

View File

@ -45,6 +45,7 @@
packages.testimonials-grid = testimonials-grid.package;
nixosModules.testimonials-grid = testimonials-grid.module;
packages.rock-paper-scissors = rock-paper-scissors.package;
packages.rock-paper-scissors-image = rock-paper-scissors.image;
nixosModules.rock-paper-scissors = rock-paper-scissors.module;
});
# see https://serokell.io/blog/practical-nix-flakes