Spaces:
Sleeping
Sleeping
FROM python:3.9-slim | |
WORKDIR /code | |
# Install system dependencies for WeasyPrint | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
python3-dev \ | |
python3-pip \ | |
python3-setuptools \ | |
python3-wheel \ | |
python3-cffi \ | |
libcairo2 \ | |
libpango-1.0-0 \ | |
libpangocairo-1.0-0 \ | |
libgdk-pixbuf2.0-0 \ | |
libffi-dev \ | |
shared-mime-info \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy requirements first to leverage Docker cache | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy application code | |
COPY . . | |
# Create templates directory if it doesn't exist | |
RUN mkdir -p templates | |
# Set environment variables | |
ENV FLASK_APP=app.py | |
ENV FLASK_ENV=production | |
# Run gunicorn | |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "600", "app:app"] |