From 97e43fa44fb1f3c67dcac7b99494facdad6cb3d9 Mon Sep 17 00:00:00 2001 From: Febin Francis <98605691+CodesbyFebin@users.noreply.github.com> Date: Sun, 8 Nov 2026 02:08:08 +0530 Subject: [PATCH 1/5] chore(docker): add Dockerfile staging build asset --- Dockerfile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bc455cb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# AgentSwarm — Node.js 24 + Bun multi-stage build +# Staging candidate only: does not provide isolated agent execution. +FROM oven/bun:1 AS dependencies +WORKDIR /workspace +COPY package.json bun.lock ./ +RUN bun install --frozen-lockfile + +FROM oven/bun:1 AS builder +WORKDIR /workspace +COPY --from=dependencies /workspace/node_modules ./node_modules +COPY . . +# Prisma schema in this repository targets PostgreSQL; no database migration runs at image build. +RUN bunx prisma generate --schema=prisma/schema.prisma +RUN bun run build + +FROM node:24-alpine AS production-runtime +WORKDIR /app +ENV NODE_ENV=production +ENV PORT=3000 +ENV HOSTNAME=0.0.0.0 +# Prisma's Linux engine uses OpenSSL at runtime. +RUN apk add --no-cache openssl \ + && addgroup -S -g 10001 swarm \ + && adduser -S -u 10001 -G swarm swarm +COPY --from=builder --chown=swarm:swarm /workspace/.next/standalone ./ +COPY --from=builder --chown=swarm:swarm /workspace/.next/static ./.next/static +COPY --from=builder --chown=swarm:swarm /workspace/public ./public +USER swarm +EXPOSE 3000 +CMD ["node", "server.js"] From 0b757dd6db1231f9295b47d8ff8f3ef7e2d24ac4 Mon Sep 17 00:00:00 2001 From: Febin Francis <98605691+CodesbyFebin@users.noreply.github.com> Date: Sun, 8 Nov 2026 02:08:10 +0530 Subject: [PATCH 2/5] chore(docker): add .dockerignore staging build asset --- .dockerignore | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a1663f2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,32 @@ +# No local secrets, build output, artifacts, or runtime state in Docker context +.git +.github +node_modules +.next +out +build +coverage +*.log +*.tsbuildinfo +.env +.env.* +!.env.example +*.pem +*.key +*.p12 +*.pfx +*.crt +*.sqlite +*.sqlite-* +*.db +*.db-* +.DS_Store +.vercel +.z-ai-config +.claude +local-* +download/ +uploads/ +backups/ +tmp/ +temp/ From c81014442acd31c2f9a30cf5ab861b2ea3a0ca80 Mon Sep 17 00:00:00 2001 From: Febin Francis <98605691+CodesbyFebin@users.noreply.github.com> Date: Sun, 8 Nov 2026 02:08:12 +0530 Subject: [PATCH 3/5] chore(docker): add .github/workflows/docker-build.yml staging build asset --- .github/workflows/docker-build.yml | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..0c75b58 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,39 @@ +name: Docker build validation + +on: + push: + branches: [main, master] + paths: + - Dockerfile + - .dockerignore + - package.json + - bun.lock + - next.config.ts + - prisma/** + - src/** + - public/** + - .github/workflows/docker-build.yml + pull_request: + paths: + - Dockerfile + - .dockerignore + - package.json + - bun.lock + - next.config.ts + - prisma/** + - src/** + - public/** + - .github/workflows/docker-build.yml + +permissions: + contents: read + +jobs: + docker-build: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Check out source + uses: actions/checkout@v4 + - name: Build staging image (no push or deployment) + run: docker build --pull --target production-runtime -t agentswarm:ci . From 0045ebde22ab32f6113ebe81b109742fb0422069 Mon Sep 17 00:00:00 2001 From: Febin Francis <98605691+CodesbyFebin@users.noreply.github.com> Date: Sun, 8 Nov 2026 02:08:14 +0530 Subject: [PATCH 4/5] chore(docker): add docs/DOCKER-STAGING.md staging build asset --- docs/DOCKER-STAGING.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docs/DOCKER-STAGING.md diff --git a/docs/DOCKER-STAGING.md b/docs/DOCKER-STAGING.md new file mode 100644 index 0000000..5b45223 --- /dev/null +++ b/docs/DOCKER-STAGING.md @@ -0,0 +1,23 @@ +# Container build — staging candidate + +This branch adds a **build-only** multi-stage Dockerfile adapted to the repository's actual dependency manager, **Bun**, and Next.js **standalone** output. Unlike the illustrative npm-based Dockerfile, this repository has `bun.lock` and no tracked `package-lock.json`; `npm ci` would therefore fail. + +## Build + +```sh +docker build --target production-runtime -t agentswarm:staging . +``` + +The Docker build runs Prisma Client generation but **does not** run schema changes, connect to a live PostgreSQL database, start workers, or certify cryptographic verification. The existing tracked Prisma schema targets **PostgreSQL**, not SQLite; changes to datasource/provider require a separately reviewed migration plan. + +For a local runtime smoke test, provide a dedicated, non-production `DATABASE_URL` through your secret manager or an untracked env file. Do not embed credentials in build arguments, images, or version control. Database schema migrations must be separately planned and executed with versioned migrations. + +The image runs as non-root UID 10001 with the Node.js 24 runtime and Next.js standalone server. Non-root does not provide a browser sandbox. Actual browser execution still requires dedicated worker isolation, network egress policy, resource limits and fencing. + +## CI and limitations + +`.github/workflows/docker-build.yml` checks that the image builds on pull requests and selected pushes. It **does not** publish or deploy the image. The Docker build is not evidence of a completed execution, a STARK proof, settlement, tenant isolation, or multi-worker concurrency correctness. + +The repository's `next.config.ts` currently sets `typescript.ignoreBuildErrors = true`. This build gate therefore does not prove TypeScript correctness. A separate strict typecheck and tests are required before staging release. + +This commit intentionally does **not** replace `package.json`, `bun.lock`, or the existing Prisma schema, and does not merge proposed untested P0 backend snippets. From 036cdc6612820b9a43b0bc446422dc0c32efcafe Mon Sep 17 00:00:00 2001 From: Febin Francis <98605691+CodesbyFebin@users.noreply.github.com> Date: Sun, 8 Nov 2026 02:08:28 +0530 Subject: [PATCH 5/5] fix(docker): align Prisma build and runtime Linux compatibility --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index bc455cb..7b62154 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,15 +13,17 @@ COPY . . RUN bunx prisma generate --schema=prisma/schema.prisma RUN bun run build -FROM node:24-alpine AS production-runtime +FROM node:24-bookworm-slim AS production-runtime WORKDIR /app ENV NODE_ENV=production ENV PORT=3000 ENV HOSTNAME=0.0.0.0 # Prisma's Linux engine uses OpenSSL at runtime. -RUN apk add --no-cache openssl \ - && addgroup -S -g 10001 swarm \ - && adduser -S -u 10001 -G swarm swarm +RUN apt-get update \ + && apt-get install -y --no-install-recommends openssl ca-certificates \ + && rm -rf /var/lib/apt/lists/* \ + && groupadd --gid 10001 swarm \ + && useradd --uid 10001 --gid swarm --no-create-home --shell /usr/sbin/nologin swarm COPY --from=builder --chown=swarm:swarm /workspace/.next/standalone ./ COPY --from=builder --chown=swarm:swarm /workspace/.next/static ./.next/static COPY --from=builder --chown=swarm:swarm /workspace/public ./public