FROM python:3.9-slim WORKDIR /app COPY requirements.txt . # Install dependencies with explicit ordering to handle dependency issues RUN pip install --no-cache-dir werkzeug==2.0.1 RUN pip install --no-cache-dir -r requirements.txt # Copy application files after dependencies are installed COPY . . # Create temp directory for file uploads with proper permissions RUN mkdir -p temp && chmod 777 temp # Set proper file permissions RUN chmod -R 755 /app && \ chmod -R 777 /app/temp EXPOSE 7860 CMD ["python", "app.py"]