FROM python:3.9-slim WORKDIR /code # Install system dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # Create uploads directory and set permissions RUN mkdir -p /code/static/uploads && \ chmod 777 /code/static/uploads # Copy requirements first to leverage Docker cache COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Ensure uploads directory has correct permissions RUN chmod 777 /code/static/uploads # Make port 7860 available to the world outside this container EXPOSE 7860 # Run the application CMD ["python", "app.py"]