Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install system dependencies required for AI models and image processing | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| libgomp1 \ | |
| libgl1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV FLASK_APP=app.py | |
| ENV FLASK_ENV=production | |
| # Copy requirements and install Python dependencies | |
| COPY requirements.txt ./ | |
| RUN pip3 install --no-cache-dir -r requirements.txt | |
| # Copy application files | |
| COPY app.py ./ | |
| COPY main.py ./ | |
| # Copy templates directory | |
| COPY templates/ ./templates/ | |
| # Copy static directory | |
| COPY static/ ./static/ | |
| # Copy uploads directory with pre-populated images | |
| COPY uploads/ ./uploads/ | |
| # Expose port (7860 for Hugging Face Spaces) | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD curl --fail http://localhost:7860/ || exit 1 | |
| # Run the Flask app | |
| CMD ["python", "app.py"] | |