# Use official Python image | |
FROM python:3.10-slim | |
# Set environment variables | |
ENV PYTHONDONTWRITEBYTECODE=1 | |
ENV PYTHONUNBUFFERED=1 | |
# Set work directory | |
WORKDIR /app | |
# Install system dependencies (wkhtmltopdf) | |
RUN apt-get update && apt-get install -y \ | |
wkhtmltopdf \ | |
libxrender1 \ | |
libxext6 \ | |
libfontconfig1 \ | |
&& apt-get clean | |
# Install Python dependencies | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy project | |
COPY . . | |
# Set environment variables for Flask | |
ENV FLASK_APP=app.py | |
ENV FLASK_RUN_HOST=0.0.0.0 | |
ENV FLASK_RUN_PORT=7860 | |
# Expose port | |
EXPOSE 7860 | |
# Run Flask app | |
CMD ["flask", "run"] | |