Spaces:
Running
Running
| # Code Review Environment — Docker Image | |
| # | |
| # Build: docker build -t code-review-env . | |
| # Run: docker run -p 7860:7860 code-review-env | |
| # Test: curl http://localhost:7860/health | |
| FROM python:3.11-slim | |
| # Create non-root user (HF Spaces requirement) | |
| RUN useradd -m -u 1000 appuser | |
| WORKDIR /app | |
| # Install dependencies first (caching layer) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY --chown=appuser:appuser . . | |
| # Switch to non-root user | |
| USER appuser | |
| # Expose port (HF Spaces uses 7860) | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1 | |
| # Start server | |
| CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |