Spaces:
Running
Running
| # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker | |
| # you will also find guides on how best to write your Dockerfile | |
| FROM python:3.12-slim | |
| # Install system deps as root | |
| USER root | |
| # Install system dependencies including Node.js and npm | |
| RUN apt-get update && apt-get install -y nodejs npm && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Create app dir | |
| WORKDIR /app | |
| # Copy backend requirements | |
| COPY --chown=user backend/requirements.txt /app/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt | |
| # Copy backend and frontend | |
| COPY --chown=user backend/ /app/backend/ | |
| COPY --chown=user frontend/ /app/frontend/ | |
| # Build frontend | |
| WORKDIR /app/frontend | |
| RUN npm install && npm run build | |
| # Back to backend | |
| WORKDIR /app/backend | |
| # Expose port | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |