Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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/
39 changes: 39 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -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 .
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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-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 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
USER swarm
EXPOSE 3000
CMD ["node", "server.js"]
23 changes: 23 additions & 0 deletions docs/DOCKER-STAGING.md
Original file line number Diff line number Diff line change
@@ -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.
Loading