-
-
Notifications
You must be signed in to change notification settings - Fork 503
feat: add Dockerfile for production deployment #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Claw3D — 3D agent visualization for OpenClaw | ||
| # Multi-stage build: install deps → build Next.js → run with custom server | ||
|
|
||
| FROM node:20-slim AS deps | ||
| WORKDIR /app | ||
| COPY package.json package-lock.json ./ | ||
| RUN npm ci --ignore-scripts | ||
|
|
||
| FROM node:20-slim AS builder | ||
| WORKDIR /app | ||
| COPY --from=deps /app/node_modules ./node_modules | ||
| COPY . . | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing
|
||
| ENV NEXT_TELEMETRY_DISABLED=1 | ||
| # Build-time gateway URL (overridden at runtime by CLAW3D_GATEWAY_URL) | ||
| ENV NEXT_PUBLIC_GATEWAY_URL=ws://localhost:18789 | ||
| RUN npm run build | ||
|
|
||
| FROM node:20-slim AS runner | ||
| WORKDIR /app | ||
| ENV NODE_ENV=production | ||
| ENV NEXT_TELEMETRY_DISABLED=1 | ||
|
|
||
| # Copy built app + custom server + node_modules | ||
| COPY --from=builder /app/.next ./.next | ||
| COPY --from=builder /app/public ./public | ||
| COPY --from=builder /app/server ./server | ||
| COPY --from=builder /app/node_modules ./node_modules | ||
| COPY --from=builder /app/package.json ./package.json | ||
| COPY --from=builder /app/next.config.ts ./next.config.ts | ||
|
|
||
| EXPOSE 3000 | ||
|
|
||
| CMD ["node", "server/index.js"] | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Production image includes all devDependencies unnecessarily
Medium Severity
The
depsstage runsnpm ci --ignore-scriptswithout--omit=dev, so devDependencies (Playwright, jsdom, Vitest, ESLint, etc.) are installed. These flow through thebuilderstage into therunnerstage via thenode_modulescopy. 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.Additional Locations (1)
Dockerfile#L26-L27