feat: adding nix docker image recipe

This commit is contained in:
efim 2023-09-27 04:49:48 +00:00
parent 9edf7f0196
commit 2070bbebb0
2 changed files with 19 additions and 3 deletions

View File

@ -1,7 +1,6 @@
{ pkgs, lib, sbt-derivation }: { pkgs, lib, sbt-derivation }:
let let pname = "countries-page";
pname = "countries-page"; in rec {
in {
package = sbt-derivation.lib.mkSbtDerivation { package = sbt-derivation.lib.mkSbtDerivation {
inherit pkgs pname; inherit pkgs pname;
# ...and the rest of the arguments # ...and the rest of the arguments
@ -19,4 +18,20 @@ in {
depsSha256 = "sha256-vdCU7UJAGi/CujA05OVw/lIomMpIFl+kW+pn8ny16JI="; depsSha256 = "sha256-vdCU7UJAGi/CujA05OVw/lIomMpIFl+kW+pn8ny16JI=";
}; };
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" = { }; };
};
};
} }

View File

@ -63,6 +63,7 @@
packages.multi-step-form-image = multi-step-form.image; packages.multi-step-form-image = multi-step-form.image;
nixosModules.multi-step-form = multi-step-form.module; nixosModules.multi-step-form = multi-step-form.module;
packages.flag-page = flags-page.package; packages.flag-page = flags-page.package;
packages.flag-page-image = flags-page.image;
}); });
# see https://serokell.io/blog/practical-nix-flakes # see https://serokell.io/blog/practical-nix-flakes
} }