itsLu commited on
Commit
2b772fc
·
verified ·
1 Parent(s): 810219d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -7
Dockerfile CHANGED
@@ -1,15 +1,24 @@
1
- FROM python:3.9-slim
 
 
 
 
 
 
2
 
 
 
3
  WORKDIR /app
4
 
5
- # Copy all files
6
  COPY . .
7
 
8
- # Install dependencies
 
 
 
 
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
- # Hugging Face expects port 7860
12
  ENV PORT=7860
13
-
14
- # Run with Gunicorn (Production Server)
15
- CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
 
1
+ # --- Stage 1: build frontend (Vite/React) ---
2
+ FROM node:20-alpine AS frontend
3
+ WORKDIR /fe
4
+ COPY clarity-enhancer-main/ ./clarity-enhancer-main/
5
+ WORKDIR /fe/clarity-enhancer-main
6
+ RUN npm ci
7
+ RUN npm run build
8
 
9
+ # --- Stage 2: backend (Flask) ---
10
+ FROM python:3.9-slim
11
  WORKDIR /app
12
 
13
+ # Copy backend repo
14
  COPY . .
15
 
16
+ # Copy built frontend into Flask static folder
17
+ RUN mkdir -p /app/static/clarity
18
+ COPY --from=frontend /fe/clarity-enhancer-main/dist/ /app/static/clarity/
19
+
20
+ # Install Python deps
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
 
23
  ENV PORT=7860
24
+ CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]