From 3a44f3f93b765006dae6bacc8f25eb7f0a7c37f8 Mon Sep 17 00:00:00 2001 From: Kris McGinnes Date: Mon, 19 Oct 2026 09:51:35 -0500 Subject: [PATCH 1/3] Copy only the files the server reads into the Docker runtime image --- Dockerfile | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 18c3b2aec..8e8139a52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,8 +43,21 @@ COPY --from=build --chown=0:0 /tmp/node/LICENSE /usr/local/LICENSE ENV HOME=/graph-explorer WORKDIR /graph-explorer -COPY --from=deps --chown=0:0 /app ./ -COPY --from=build --chown=0:0 /app ./ +# Only what the entrypoint and the server read. The server runs its TypeScript +# source directly and loads @graph-explorer/shared from source through the +# workspace symlink, so both keep src and package.json. The pnpm symlinks in +# each node_modules point into the root one. +COPY --from=deps --chown=0:0 /app/node_modules ./node_modules +COPY --from=deps --chown=0:0 /app/packages/graph-explorer/node_modules ./packages/graph-explorer/node_modules +COPY --from=deps --chown=0:0 /app/packages/graph-explorer-proxy-server/node_modules ./packages/graph-explorer-proxy-server/node_modules +COPY --from=build --chown=0:0 /app/docker-entrypoint.sh /app/process-environment.sh /app/setup-ssl.sh /app/LICENSE /app/NOTICE /app/THIRD_PARTY_LICENSES.txt ./ +COPY --from=build --chown=0:0 /app/packages/graph-explorer/.env ./packages/graph-explorer/ +COPY --from=build --chown=0:0 /app/packages/graph-explorer/dist ./packages/graph-explorer/dist +COPY --from=build --chown=0:0 /app/packages/graph-explorer-proxy-server/package.json ./packages/graph-explorer-proxy-server/ +COPY --from=build --chown=0:0 /app/packages/graph-explorer-proxy-server/cert-info ./packages/graph-explorer-proxy-server/cert-info +COPY --from=build --chown=0:0 --exclude=*.test.ts --exclude=test-setup.ts --exclude=testing.ts /app/packages/graph-explorer-proxy-server/src ./packages/graph-explorer-proxy-server/src +COPY --from=build --chown=0:0 /app/packages/shared/package.json ./packages/shared/ +COPY --from=build --chown=0:0 --exclude=utils/testing /app/packages/shared/src ./packages/shared/src EXPOSE 443 EXPOSE 80 From 4e6e27401b6de4bb680b7b6c2c1c29eebbc3379b Mon Sep 17 00:00:00 2001 From: Kris McGinnes Date: Mon, 19 Oct 2026 09:51:37 -0500 Subject: [PATCH 2/3] Check that the built Docker image serves the UI --- .github/workflows/test_build_docker.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test_build_docker.yml b/.github/workflows/test_build_docker.yml index 4ea74a9e7..2af84f637 100644 --- a/.github/workflows/test_build_docker.yml +++ b/.github/workflows/test_build_docker.yml @@ -72,6 +72,14 @@ jobs: if curl -sfk "$scheme://localhost:$host_port/status"; then echo "" echo "✓ $name responded on /status" + # The client build is the file most likely to go missing from the image. + ui_status=$(curl -sk -o /dev/null -w '%{http_code}' "$scheme://localhost:$host_port/explorer/") + if [ "$ui_status" != 200 ]; then + echo "FAIL: $name returned $ui_status for the UI at /explorer/" + docker rm -f "$name" >/dev/null + return 1 + fi + echo "✓ $name served the UI at /explorer/" docker rm -f "$name" >/dev/null return 0 fi From b1f9ee31061229a0f4172987bfa92eb6d1ccc358 Mon Sep 17 00:00:00 2001 From: Kris McGinnes Date: Mon, 19 Oct 2026 11:02:47 -0500 Subject: [PATCH 3/3] Leave tests out of the Docker build context --- .dockerignore | 11 +++++++++++ Dockerfile | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index fa9710133..de81c604d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -32,3 +32,14 @@ images **/cert-info/*.srl **/*.local.* **/dist + +# Tests and their helpers. The build bundles only what the client imports, and +# the server image ships src as-is, so leaving these out keeps them out of the +# image and keeps a test-only edit from invalidating the build layer. +**/*.test.ts +**/*.test.tsx +**/setupTests.ts +**/test-setup.ts +**/testing.ts +**/testing +samples diff --git a/Dockerfile b/Dockerfile index 8e8139a52..81a7ebcba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,9 +55,9 @@ COPY --from=build --chown=0:0 /app/packages/graph-explorer/.env ./packages/graph COPY --from=build --chown=0:0 /app/packages/graph-explorer/dist ./packages/graph-explorer/dist COPY --from=build --chown=0:0 /app/packages/graph-explorer-proxy-server/package.json ./packages/graph-explorer-proxy-server/ COPY --from=build --chown=0:0 /app/packages/graph-explorer-proxy-server/cert-info ./packages/graph-explorer-proxy-server/cert-info -COPY --from=build --chown=0:0 --exclude=*.test.ts --exclude=test-setup.ts --exclude=testing.ts /app/packages/graph-explorer-proxy-server/src ./packages/graph-explorer-proxy-server/src +COPY --from=build --chown=0:0 /app/packages/graph-explorer-proxy-server/src ./packages/graph-explorer-proxy-server/src COPY --from=build --chown=0:0 /app/packages/shared/package.json ./packages/shared/ -COPY --from=build --chown=0:0 --exclude=utils/testing /app/packages/shared/src ./packages/shared/src +COPY --from=build --chown=0:0 /app/packages/shared/src ./packages/shared/src EXPOSE 443 EXPOSE 80