chih.yikuan Claude Opus 4.6 (1M context) commited on
Commit
b17eeed
·
1 Parent(s): cd0918a

Fix: Add .dockerignore and optimize Dockerfile to reduce image size

Browse files

The Space was stuck in BUILDING due to 194MB node_modules being included
in the Docker build context. Added .dockerignore and switched to selective
COPY for frontend source files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Files changed (2) hide show
  1. .dockerignore +11 -0
  2. Dockerfile +5 -3
.dockerignore ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ node_modules
2
+ .git
3
+ .gitignore
4
+ *.md
5
+ backend/
6
+ __pycache__
7
+ *.pyc
8
+ *.egg-info
9
+ .env
10
+ .venv
11
+ .ruff_cache
Dockerfile CHANGED
@@ -8,14 +8,16 @@ FROM node:20-slim AS frontend-builder
8
 
9
  WORKDIR /app/frontend
10
 
11
- # Copy package files
12
  COPY chatkit/frontend/package*.json ./
13
 
14
  # Install dependencies
15
  RUN npm ci --legacy-peer-deps
16
 
17
- # Copy source files
18
- COPY chatkit/frontend/ ./
 
 
19
 
20
  # Build for production (output to dist/)
21
  RUN npm run build
 
8
 
9
  WORKDIR /app/frontend
10
 
11
+ # Copy package files first for layer caching
12
  COPY chatkit/frontend/package*.json ./
13
 
14
  # Install dependencies
15
  RUN npm ci --legacy-peer-deps
16
 
17
+ # Copy source files (after npm ci to leverage cache)
18
+ COPY chatkit/frontend/src ./src
19
+ COPY chatkit/frontend/public ./public
20
+ COPY chatkit/frontend/index.html chatkit/frontend/vite.config.ts chatkit/frontend/tsconfig*.json chatkit/frontend/postcss.config.mjs chatkit/frontend/eslint.config.mjs ./
21
 
22
  # Build for production (output to dist/)
23
  RUN npm run build