diff --git a/frontend/next.config.mjs b/frontend/next.config.mjs index ce62d0d..3b6279e 100644 --- a/frontend/next.config.mjs +++ b/frontend/next.config.mjs @@ -7,7 +7,8 @@ const nextConfig = destination: 'http://localhost:8080/:path*' // Proxy to Backend } ] - } + }, + output: 'export' }; export default nextConfig; diff --git a/nix/containers.nix b/nix/containers.nix index 0e8ff68..d96c396 100644 --- a/nix/containers.nix +++ b/nix/containers.nix @@ -1,28 +1,19 @@ { repoRoot, inputs, pkgs, lib, system }: let -staticFilesDerivation = pkgs.stdenv.mkDerivation { - name = "staticFiles"; - src = ../generated; - unpackPhase = "true"; +frontendNpm = pkgs.buildNpmPackage rec { + name = "frontend"; + src = ../frontend; + npmDepsHash = "sha256-Oz7pdTMJVgGj5rzjIMvDjaOV7JU+hYLHoSSb+OcJARk="; + npmPackFlags = [ "--ignore-scripts" ]; installPhase = '' - ls -alh "$src" - mkdir -p "$out" - cp -r $src/html $out - ls -alh $out + mkdir -p $out/frontend + cp -r out/* $out/frontend ''; }; -staticFiles = pkgs.buildEnv { - name = "staticFiles"; - paths = [ - # the actual payload we want - staticFilesDerivation - # allow interactivity with the image - pkgs.bashInteractive - pkgs.coreutils - ]; - pathsToLink = [ "/html" "/bin" ]; - extraOutputsToInstall = [ "/html" ]; +frontend = pkgs.buildEnv { + name = "frontend"; + paths = [ frontendNpm ]; }; in rec { @@ -40,7 +31,7 @@ in rec { #$ ./result/bin/copy-to dir:./tmp # # Now we can run the container (the tx is just some random I copied from the explorer) - #$ podman run --publish 8080:8080 --env WST_BLOCKFROST_TOKEN=REPLACE_ME_APIKEY dir:./tmp manage 76e2cfb0b087873ef50a3f709fa6ab3df21bdd5b67c1254837cc353613524251.0 start --static-files /html + #$ podman run --publish 8080:8080 --env WST_BLOCKFROST_TOKEN=REPLACE_ME_APIKEY dir:./tmp manage 76e2cfb0b087873ef50a3f709fa6ab3df21bdd5b67c1254837cc353613524251.0 start --static-files /frontend # # NOTE: To build the oci container image run: # @@ -52,8 +43,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]; }) ]; };