FROM python:3.12-slim | |
WORKDIR /app | |
# Install system dependencies | |
RUN apt-get update && \ | |
apt-get install -y build-essential git && \ | |
apt-get install -y libxrender1 libxext6 && \ | |
apt-get clean | |
# Copy requirements first to leverage Docker cache | |
COPY requirements.txt . | |
RUN pip install --upgrade pip | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy application code | |
COPY . . | |
# Create necessary directories with proper permissions | |
RUN mkdir -p uploads md_files && \ | |
chmod 777 uploads && \ | |
chmod 755 md_files && \ | |
mkdir -p /tmp/matplotlib && \ | |
chmod 777 /tmp/matplotlib | |
# Set matplotlib config directory | |
ENV MPLCONFIGDIR=/tmp/matplotlib | |
EXPOSE 7860 | |
# Default command | |
# CMD ["gunicorn", "--config", "gunicorn_config.py", "app:app"] | |
CMD ["python", "app.py"] | |