Spaces:
Running
Running
File size: 1,357 Bytes
d845520 f9ff1a1 b0ba3f4 f9ff1a1 d845520 f9ff1a1 b0ba3f4 f9ff1a1 5a9f58e b0ba3f4 10c1118 f9ff1a1 b0ba3f4 5a9f58e b0ba3f4 f9ff1a1 5a9f58e f9ff1a1 5a9f58e f9ff1a1 b0ba3f4 d845520 f9ff1a1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | # Stage 1: Build React frontend
FROM node:20-slim AS frontend-builder
WORKDIR /app
COPY frontend/package*.json frontend/
RUN cd frontend && npm ci --silent
COPY frontend/ frontend/
RUN mkdir -p static/react && cd frontend && npm run build
# Stage 2: Python runtime
FROM python:3.10-slim
# System libs needed by opencv, insightface, mediapipe
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
libgl1 \
libglib2.0-0 \
libsm6 \
libxrender1 \
libxext6 \
wget \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Step 1: torch CPU wheels (separate index — must be isolated from PyPI installs)
RUN pip install --no-cache-dir \
--extra-index-url https://download.pytorch.org/whl/cpu \
torch==2.3.0+cpu \
torchvision==0.18.0+cpu
# Step 2: all other Python deps (PyPI only, no index conflict)
COPY requirements-deploy.txt .
RUN pip install --no-cache-dir -r requirements-deploy.txt
# Copy React build from stage 1
COPY --from=frontend-builder /app/static/react ./static/react
# Copy app source
COPY . .
RUN mkdir -p models uploads/temp outputs/results
ENV PORT=7860
EXPOSE 7860
# Fix CRLF line endings (Windows → Linux) then make executable
RUN sed -i 's/\r$//' startup.sh && chmod +x startup.sh
CMD ["./startup.sh"]
|