Spaces:
Sleeping
Sleeping
| FROM python:3.12-slim | |
| # Create non-root user (HF Spaces requirement) | |
| RUN useradd -m -u 1000 user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR /app | |
| # Copy and install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy source code | |
| COPY . . | |
| # Install the package | |
| RUN pip install --no-cache-dir -e . | |
| # Switch to non-root user | |
| USER user | |
| # Expose port (7860 for HF Spaces) | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ | |
| CMD python -c "import requests; requests.get('http://localhost:7860/health').raise_for_status()" || exit 1 | |
| # Run the server | |
| CMD ["uvicorn", "dataclean_env.server.app:app", "--host", "0.0.0.0", "--port", "7860"] | |