Spaces:
Build error
Build error
File size: 1,705 Bytes
5c3a005 | 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | # ---------- FRONTEND BUILD ----------
FROM node:20 AS frontend-build
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build
# ---------- BACKEND BUILD ----------
FROM python:3.10-slim AS backend-build
WORKDIR /app/backend
# System deps for opencv/insightface
RUN apt-get update && apt-get install -y \
gcc \
g++ \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
COPY backend/requirements.txt .
# Upgrade pip first
RUN pip install --upgrade pip
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend source
COPY backend/ .
# ---------- FINAL IMAGE ----------
FROM python:3.10-slim
WORKDIR /app
# Runtime libs only
RUN apt-get update && apt-get install -y \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Copy installed python packages
COPY --from=backend-build /usr/local/lib/python3.10 /usr/local/lib/python3.10
COPY --from=backend-build /usr/local/bin /usr/local/bin
# Copy backend
COPY --from=backend-build /app/backend /app/backend
# Copy frontend build
COPY --from=frontend-build /app/frontend/dist /app/backend/static
WORKDIR /app/backend
EXPOSE 8000
ENV PYTHONUNBUFFERED=1
ENV PORT=8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] |