Spaces:
Paused
Paused
| FROM python:3.11-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| HF_HUB_ENABLE_HF_TRANSFER=1 \ | |
| EXPORT_DIR=/app/models/exports | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| git \ | |
| curl \ | |
| ca-certificates \ | |
| libgomp1 \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements and install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --upgrade pip && \ | |
| pip install -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Create necessary directories | |
| RUN mkdir -p models/exports data/Polyvore | |
| # Make scripts executable | |
| RUN chmod +x scripts/*.sh | |
| # Expose ports | |
| EXPOSE 8000 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ | |
| CMD curl -f http://localhost:8000/health || exit 1 | |
| # Default command | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] | |