Princeaka commited on
Commit
5c566a4
·
verified ·
1 Parent(s): 47f27f6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -4
Dockerfile CHANGED
@@ -1,12 +1,16 @@
1
- # --- Frontend Stage ---
2
  FROM node:20-alpine AS frontend
3
  WORKDIR /ui
 
 
4
  COPY frontend/package*.json ./
5
- RUN npm ci --silent
 
 
6
  COPY frontend ./
7
  RUN npm run build
8
 
9
- # --- Backend Stage ---
10
  FROM python:3.11-slim
11
  WORKDIR /app
12
 
@@ -18,8 +22,11 @@ RUN pip install --no-cache-dir -r requirements.txt
18
  COPY backend ./backend
19
  COPY app.py Procfile .env.example ./
20
 
21
- # Copy built frontend
22
  COPY --from=frontend /ui/dist ./frontend_dist
23
 
 
 
 
24
  EXPOSE 7860
25
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # --- Frontend Stage (React + Vite) ---
2
  FROM node:20-alpine AS frontend
3
  WORKDIR /ui
4
+
5
+ # Copy package files and install deps
6
  COPY frontend/package*.json ./
7
+ RUN npm ci --silent || npm install --silent
8
+
9
+ # Copy frontend source and build
10
  COPY frontend ./
11
  RUN npm run build
12
 
13
+ # --- Backend Stage (FastAPI + Python) ---
14
  FROM python:3.11-slim
15
  WORKDIR /app
16
 
 
22
  COPY backend ./backend
23
  COPY app.py Procfile .env.example ./
24
 
25
+ # Copy built frontend from frontend stage
26
  COPY --from=frontend /ui/dist ./frontend_dist
27
 
28
+ # Bust cache so Hugging Face doesn’t reuse stale Node layers
29
+ ARG CACHE_BUST=1
30
+
31
  EXPOSE 7860
32
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]