diff --git a/.gitignore b/.gitignore index 32458e4..a4590c9 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,3 @@ supabase/.temp # Nixpacks build plan generated by `railway up`. It bakes absolute paths to the # worktree it was generated in and a one-off image tag, so it is never reusable # and every regeneration conflicts with the last one. -.nixpacks/ diff --git a/.nixpacks/Dockerfile b/.nixpacks/Dockerfile new file mode 100644 index 0000000..a6f20ee --- /dev/null +++ b/.nixpacks/Dockerfile @@ -0,0 +1,36 @@ +FROM ghcr.io/railwayapp/nixpacks:ubuntu-1745885067 + +ENTRYPOINT ["/bin/bash", "-l", "-c"] +WORKDIR /app/ +ARG PUBLIC_URL +ENV PUBLIC_URL=$PUBLIC_URL + + +COPY .nixpacks/nixpkgs-ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.nix .nixpacks/nixpkgs-ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.nix +RUN nix-env -if .nixpacks/nixpkgs-ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.nix && nix-collect-garbage -d + + +ARG CI NIXPACKS_METADATA NIXPACKS_NODE_VERSION NODE_ENV NPM_CONFIG_PRODUCTION +ENV CI=$CI NIXPACKS_METADATA=$NIXPACKS_METADATA NIXPACKS_NODE_VERSION=$NIXPACKS_NODE_VERSION NODE_ENV=$NODE_ENV NPM_CONFIG_PRODUCTION=$NPM_CONFIG_PRODUCTION + +# setup phase +# noop + +# install phase +ENV NIXPACKS_PATH=/app/node_modules/.bin:$NIXPACKS_PATH +COPY . /app/. +RUN --mount=type=cache,id=myZsC0wNW9Q-/root/npm,target=/root/.npm npm ci + +# build phase +COPY . /app/. +RUN --mount=type=cache,id=myZsC0wNW9Q-apps/logicsrc-web/next/cache,target=/app/apps/logicsrc-web/.next/cache --mount=type=cache,id=myZsC0wNW9Q-node_modules/cache,target=/app/node_modules/.cache npm run build + + +RUN printf '\nPATH=/app/node_modules/.bin:$PATH' >> /root/.profile + + +# start +COPY . /app + +CMD ["npm run start"] + diff --git a/.nixpacks/build.sh b/.nixpacks/build.sh new file mode 100644 index 0000000..6d69979 --- /dev/null +++ b/.nixpacks/build.sh @@ -0,0 +1 @@ +docker build /home/anthony/src/profullstack/logicsrc/.claude/worktrees/dev2-logicsrc.com-8sr7z6_r -f /home/anthony/src/profullstack/logicsrc/.claude/worktrees/dev2-logicsrc.com-8sr7z6_r/.nixpacks/Dockerfile -t 4c321096-0f24-4fcc-8a9b-8098036fecc1 --build-arg CI=true --build-arg NIXPACKS_METADATA=node --build-arg NIXPACKS_NODE_VERSION=22 --build-arg NODE_ENV=production --build-arg NPM_CONFIG_PRODUCTION=false \ No newline at end of file diff --git a/.nixpacks/nixpkgs-ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.nix b/.nixpacks/nixpkgs-ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.nix new file mode 100644 index 0000000..21d2210 --- /dev/null +++ b/.nixpacks/nixpkgs-ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.nix @@ -0,0 +1,21 @@ +{ }: + +let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.tar.gz") { overlays = [ (import (builtins.fetchTarball "https://github.com/railwayapp/nix-npm-overlay/archive/main.tar.gz")) ]; }; +in with pkgs; + let + APPEND_LIBRARY_PATH = "${lib.makeLibraryPath [ gcc-unwrapped ] }"; + myLibraries = writeText "libraries" '' + export LD_LIBRARY_PATH="${APPEND_LIBRARY_PATH}:$LD_LIBRARY_PATH" + + ''; + in + buildEnv { + name = "ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7-env"; + paths = [ + (runCommand "ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7-env" { } '' + mkdir -p $out/etc/profile.d + cp ${myLibraries} $out/etc/profile.d/ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7-env.sh + '') + nodejs_22 npm-9_x + ]; + }