feat(11): docker image for price grid app

This commit is contained in:
efim 2023-07-04 05:19:57 +00:00
parent 572b63c82d
commit 88e1d04e0d
2 changed files with 33 additions and 4 deletions

View File

@ -1,10 +1,10 @@
{ pkgs, lib, sbt-derivation }: { pkgs, lib, sbt-derivation }:
let let
pname = "price-grid-app";
package = sbt-derivation.lib.mkSbtDerivation { package = sbt-derivation.lib.mkSbtDerivation {
inherit pkgs; inherit pkgs pname;
# ...and the rest of the arguments # ...and the rest of the arguments
pname = "price-grid-app";
version = "0.0.1"; version = "0.0.1";
src = pkgs.nix-gitignore.gitignoreSource [ ] ./.; src = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
nativeBuildInputs = [ pkgs.nodePackages.tailwindcss ]; nativeBuildInputs = [ pkgs.nodePackages.tailwindcss ];
@ -84,7 +84,35 @@ let
}; };
}; };
}; };
image = pkgs.dockerTools.buildLayeredImage {
name = pname;
tag = "latest";
created = "now";
config = {
Cmd = [ "${pkgs.jdk}/bin/java" "-jar" "${package}/bin/priceGridApp.jar" "--host" "0.0.0.0" ];
ExposedPorts = {
"8080/tcp" = {};
};
WorkingDir = "${package}/bin";
};
};
# image = pkgs.dockerTools.buildImage {
# name = pname;
# tag = "latest";
# created = "now";
# copyToRoot = pkgs.buildEnv {
# name = "image-root";
# paths = [ package pkgs.dockerTools.binSh pkgs.coreutils ];
# pathsToLink = [ "/bin" "/dist" "/public" ];
# };
# config = {
# Cmd = [ "${pkgs.jdk}/bin/java" "-jar" "${package}/bin/priceGridApp.jar" "--host" "0.0.0.0" ];
# ExposedPorts = {
# "8080/tcp" = {};
# };
# WorkingDir = "${package}/bin";
# };
# };
in { in {
package = package; inherit package module image;
module = module;
} }

View File

@ -40,6 +40,7 @@
}; };
packages.price-grid-app = price-grid.package; packages.price-grid-app = price-grid.package;
nixosModules.price-grid-app = price-grid.module; nixosModules.price-grid-app = price-grid.module;
packages.price-grid-app-image = price-grid.image;
packages.order-summary = order-summary.package; packages.order-summary = order-summary.package;
nixosModules.order-summary = order-summary.module; nixosModules.order-summary = order-summary.module;
packages.testimonials-grid = testimonials-grid.package; packages.testimonials-grid = testimonials-grid.package;