Spaces:
Running
Running
| FROM node:18-bullseye AS frontend-builder | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm install | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| FROM python:3.9-slim | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Install dependencies | |
| COPY --chown=user:user frontend/requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy backend code | |
| COPY --chown=user:user frontend/api ./api | |
| COPY --chown=user:user frontend/.env ./ | |
| # Copy compiled frontend from builder | |
| COPY --chown=user:user --from=frontend-builder /app/frontend/dist ./frontend/dist | |
| # Expose Hugging Face Space port | |
| EXPOSE 7860 | |
| # Start FastAPI | |
| CMD ["uvicorn", "api.index:app", "--host", "0.0.0.0", "--port", "7860"] | |