Spaces:
Runtime error
Runtime error
madhurithika22
deploy: add backend codebase and Dockerfile configuration for Hugging Face Spaces
35512c1 | FROM python:3.10-slim | |
| # Create user with UID 1000 | |
| RUN useradd -m -u 1000 user | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| libgomp1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements and install | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy backend files | |
| COPY --chown=user:user . . | |
| # Set environment variables | |
| ENV UPLOAD_DIR=/app/uploads | |
| RUN mkdir -p /app/uploads && chown -R user:user /app/uploads | |
| # Switch to the non-root user | |
| USER user | |
| # Expose port (default for HF Spaces is 7860) | |
| EXPOSE 7860 | |
| # Run FastAPI app on port 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |