FROM python:3.9-slim WORKDIR /code # Install system dependencies for WeasyPrint RUN apt-get update && apt-get install -y \ build-essential \ python3-cffi \ python3-brotli \ libpango-1.0-0 \ libharfbuzz0b \ libpangoft2-1.0-0 \ libcairo2 \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create necessary directories RUN mkdir -p static/plots # Set environment variables ENV PYTHONUNBUFFERED=1 ENV PORT=7860 # Expose the port EXPOSE 7860 # Run the application CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "8", "--timeout", "0", "app:app"]