Spaces:
Sleeping
Sleeping
| FROM node:20-alpine AS frontend-build | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm ci | |
| COPY frontend/ . | |
| RUN npm run build | |
| FROM python:3.11-slim | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends git ffmpeg && \ | |
| rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Create data dir while still root, then chown it | |
| RUN mkdir -p data && chown user:user data | |
| COPY --chown=user requirements.txt . | |
| USER user | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| COPY --chown=user backend/ ./backend/ | |
| COPY --from=frontend-build --chown=user /app/frontend/dist ./frontend/dist/ | |
| EXPOSE 7860 | |
| WORKDIR $HOME/app/backend | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] |