Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +21 -17
Dockerfile
CHANGED
@@ -2,41 +2,45 @@
|
|
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 |
-
|
|
|
13 |
WORKDIR /app
|
14 |
|
15 |
-
# Install system dependencies
|
16 |
-
RUN apt-get update &&
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
# Copy and install Python dependencies
|
29 |
COPY requirements.txt ./
|
|
|
30 |
RUN pip install --no-cache-dir -r requirements.txt
|
31 |
|
32 |
# Copy backend code
|
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
|
|
|
2 |
FROM node:20-alpine AS frontend
|
3 |
WORKDIR /ui
|
4 |
|
5 |
+
# Copy package files and install dependencies
|
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 |
+
# Use full Debian image for compatibility with Python packages
|
15 |
+
FROM python:3.11-bullseye
|
16 |
WORKDIR /app
|
17 |
|
18 |
+
# Install system dependencies often required for Python packages
|
19 |
+
RUN apt-get update && \
|
20 |
+
apt-get install -y --no-install-recommends \
|
21 |
+
build-essential \
|
22 |
+
git \
|
23 |
+
ffmpeg \
|
24 |
+
libsm6 \
|
25 |
+
libxext6 \
|
26 |
+
cmake \
|
27 |
+
libgl1-mesa-glx \
|
28 |
+
python3-dev \
|
29 |
+
&& rm -rf /var/lib/apt/lists/*
|
30 |
+
|
31 |
+
# Copy requirements and install Python dependencies
|
32 |
COPY requirements.txt ./
|
33 |
+
RUN pip install --upgrade pip
|
34 |
RUN pip install --no-cache-dir -r requirements.txt
|
35 |
|
36 |
# Copy backend code
|
37 |
COPY backend ./backend
|
38 |
COPY app.py Procfile .env.example ./
|
39 |
|
40 |
+
# Copy built frontend from frontend stage
|
41 |
COPY --from=frontend /ui/dist ./frontend_dist
|
42 |
|
43 |
+
# Bust cache so Hugging Face doesn’t reuse stale Node layers
|
44 |
ARG CACHE_BUST=1
|
45 |
|
46 |
EXPOSE 7860
|