# Use Python 3.9 slim base image for a smaller footprint FROM python:3.11.10 RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set working directory WORKDIR /app # Copy requirements.txt first to leverage Docker caching COPY requirements.txt . # Upgrade pip and install Python dependencies RUN pip install --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy the application code COPY app.py . # Create directories for image storage RUN mkdir -p cloud_storage/temp cloud_storage/permanent cloud_storage/thumbs # Expose port 7860 for Gradio/FastAPI EXPOSE 7860 # Set environment variables for better Python performance ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Run the application with Uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]