GCP: fix Dockerfile.production for Cloud Build and add config files

This commit is contained in:
Jonathan Nelson 2026-01-26 20:14:01 -05:00
parent b7df99f14c
commit 1406098569
3 changed files with 94 additions and 9 deletions

71
.gcloudignore Normal file
View File

@ -0,0 +1,71 @@
# Cloud Build ignore file
# Note: This overrides .gitignore for gcloud builds submit
# Large directories not needed for build
.git
.worktrees
.bun-cache
.bun
.tmp
**/.tmp
.DS_Store
**/.DS_Store
# Media files
*.png
*.jpg
*.jpeg
*.webp
*.gif
*.mp4
*.mov
*.wav
*.mp3
# Dependencies (will be installed fresh)
node_modules
**/node_modules
.pnpm-store
**/.pnpm-store
.turbo
**/.turbo
.cache
**/.cache
.next
**/.next
coverage
**/coverage
*.log
tmp
**/tmp
# Build artifacts (not needed, we rebuild)
dist
**/dist
apps/macos/.build
apps/ios/build
**/*.trace
# Large app trees not needed for Docker build
apps/
Peekaboo/
Swabble/
Core/
Users/
vendor/
# Keep assets, skills, extensions, docs (needed for runtime)
!assets/
!skills/
!extensions/
!docs/
# Local files
.env
.conda-env
.envrc
.local/
.vscode/
IDENTITY.md
USER.md
.serena/

View File

@ -35,7 +35,8 @@ ENV CLAWDBOT_PREFER_PNPM=1
RUN pnpm ui:install
RUN pnpm ui:build
# Prune dev dependencies for production
# Prune dev dependencies for production (CI=true avoids TTY prompt)
ENV CI=true
RUN pnpm prune --prod
# --------------------------------------------
@ -52,17 +53,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
WORKDIR /app
# Copy only production artifacts
# Copy only production artifacts (dist/ includes control-ui from ui:build)
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
COPY --from=builder /app/assets ./assets
COPY --from=builder /app/skills ./skills
COPY --from=builder /app/extensions ./extensions
COPY --from=builder /app/docs ./docs
# Copy UI build output if present
COPY --from=builder /app/ui/dist ./ui/dist
# Copy optional runtime directories if they exist (using wildcards for optional copy)
COPY --from=builder /app/skill[s] ./skills/
COPY --from=builder /app/extension[s] ./extensions/
COPY --from=builder /app/doc[s] ./docs/
# Create non-root user (node user already exists in node image)
RUN chown -R node:node /app
@ -77,4 +76,4 @@ HEALTHCHECK --interval=60s --timeout=5s --retries=2 \
ENV NODE_ENV=production
CMD ["node", "dist/index.js", "gateway", "--bind", "lan", "--port", "18789"]
CMD ["node", "dist/index.js", "gateway", "--bind", "lan", "--port", "18789", "--allow-unconfigured"]

15
cloudbuild.yaml Normal file
View File

@ -0,0 +1,15 @@
steps:
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-f'
- 'Dockerfile.production'
- '-t'
- 'gcr.io/$PROJECT_ID/clawdbot:latest'
- '.'
timeout: '1800s'
images:
- 'gcr.io/$PROJECT_ID/clawdbot:latest'
timeout: '2400s'