Princeaka commited on
Commit
e09506a
·
verified ·
1 Parent(s): 98d2291

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -7
Dockerfile CHANGED
@@ -2,19 +2,30 @@
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
 
17
- # Install Python dependencies
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  COPY requirements.txt ./
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
@@ -22,11 +33,11 @@ RUN pip install --no-cache-dir -r requirements.txt
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"]
 
2
  FROM node:20-alpine AS frontend
3
  WORKDIR /ui
4
 
 
5
  COPY frontend/package*.json ./
6
  RUN npm ci --silent || npm install --silent
7
 
 
8
  COPY frontend ./
9
  RUN npm run build
10
 
11
  # --- Backend Stage (FastAPI + Python) ---
12
+ FROM python:3.11-bullseye # Use full Debian, not slim
13
  WORKDIR /app
14
 
15
+ # Install system dependencies needed for Python packages
16
+ RUN apt-get update && apt-get install -y \
17
+ build-essential \
18
+ git \
19
+ ffmpeg \
20
+ libsm6 \
21
+ libxext6 \
22
+ libsndfile1 \
23
+ && rm -rf /var/lib/apt/lists/*
24
+
25
+ # Upgrade pip, setuptools, wheel
26
+ RUN python -m pip install --upgrade pip setuptools wheel
27
+
28
+ # Copy and install Python dependencies
29
  COPY requirements.txt ./
30
  RUN pip install --no-cache-dir -r requirements.txt
31
 
 
33
  COPY backend ./backend
34
  COPY app.py Procfile .env.example ./
35
 
36
+ # Copy built frontend
37
  COPY --from=frontend /ui/dist ./frontend_dist
38
 
39
+ # Bust cache
40
  ARG CACHE_BUST=1
41
 
42
  EXPOSE 7860
43
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]