FROM python:3.11-slim WORKDIR /app ENV PYTHONPATH=/app:$PYTHONPATH # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ gcc curl && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt # Copy all project files COPY . . # Optional: create non-root user RUN useradd -m -u 1000 user && chown -R user:user /app USER user EXPOSE 7860 CMD ["python", "app.py"]