feat: add Dockerfile for production deployment#82
Conversation
Multi-stage Docker build for containerized deployments: - Stage 1 (deps): npm ci with lock file - Stage 2 (builder): Next.js production build - Stage 3 (runner): minimal image with custom server Supports runtime gateway configuration via CLAW3D_GATEWAY_URL env var without requiring a rebuild.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| FROM node:20-slim AS builder | ||
| WORKDIR /app | ||
| COPY --from=deps /app/node_modules ./node_modules | ||
| COPY . . |
There was a problem hiding this comment.
Missing .dockerignore lets COPY . . overwrite clean deps
High Severity
There is no .dockerignore file in the repository. The COPY . . in the builder stage runs after COPY --from=deps /app/node_modules ./node_modules, so if a node_modules/ directory exists on the build host, it overwrites the clean, reproducible install from the deps stage. This defeats the purpose of the multi-stage build and npm ci. It also sends the entire repository (including .git/, test files, .env files with potential secrets) into the build context and image layers.
| FROM node:20-slim AS deps | ||
| WORKDIR /app | ||
| COPY package.json package-lock.json ./ | ||
| RUN npm ci --ignore-scripts |
There was a problem hiding this comment.
Production image includes all devDependencies unnecessarily
Medium Severity
The deps stage runs npm ci --ignore-scripts without --omit=dev, so devDependencies (Playwright, jsdom, Vitest, ESLint, etc.) are installed. These flow through the builder stage into the runner stage via the node_modules copy. This contradicts the stated goal of "minimal image size" from the three-stage build and adds significant bloat plus unnecessary attack surface to the production image.


Summary
Adds a multi-stage Dockerfile for containerized production deployments of Claw3D.
Motivation
Running Claw3D alongside other Docker services (e.g., on a server that already runs OpenClaw + supporting infrastructure via docker-compose) is much easier with a Dockerfile. Currently users must install Node.js on the host and run
npm run devornpm run build && npm startdirectly.Details
Three-stage build for minimal image size:
npm ciwith lock file for reproducible installsSupports runtime gateway configuration via
CLAW3D_GATEWAY_URLenv var without requiring a rebuild. Default port is 3000, configurable viaPORTenv var.Example docker-compose usage
Test plan
docker build -t claw3d .succeedsdocker run -e CLAW3D_GATEWAY_URL=ws://localhost:18789 -p 3000:3000 claw3dstarts and serves UINote
Low Risk
Low risk because it only adds container packaging/build configuration and does not change runtime application logic. Primary risk is build/startup mismatches in the container (missing files/env defaults).
Overview
Adds a new
Dockerfilethat enables containerized production deployments via a three-stage build (deps→builder→runner).The image builds the Next.js app with telemetry disabled and a default
NEXT_PUBLIC_GATEWAY_URL, then runs the existing custom server vianode server/index.json port3000.Written by Cursor Bugbot for commit cd660d4. This will update automatically on new commits. Configure here.