diff --git a/nix/containers.nix b/nix/containers.nix index 0e8ff68..8d0675c 100644 --- a/nix/containers.nix +++ b/nix/containers.nix @@ -25,6 +25,23 @@ staticFiles = pkgs.buildEnv { extraOutputsToInstall = [ "/html" ]; }; +frontendNpm = pkgs.buildNpmPackage rec { + name = "frontend"; + src = ../frontend; + npmDepsHash = "sha256-Oz7pdTMJVgGj5rzjIMvDjaOV7JU+hYLHoSSb+OcJARk="; + npmPackFlags = [ "--ignore-scripts" ]; + installPhase = '' + mkdir -p $out/frontend + cp -r .next/* $out/frontend + rm -rf $out/frontend/cache + ''; +}; + +frontend = pkgs.buildEnv { + name = "frontend"; + paths = [ frontendNpm ]; +}; + in rec { # Builds a docker container for the cabal executable given as input. First we @@ -52,8 +69,9 @@ in rec { Entrypoint = lib.singleton (lib.getExe inputs.self.packages.wst-poc-cli); }; layers = [ + # npm-created data for frontend (inputs.n2c.packages.nix2container.buildLayer { - copyToRoot = [staticFiles]; + copyToRoot = [frontend]; }) ]; };