FROM python:3.10-slim WORKDIR /app ENV NO_PROXY="localhost,127.0.0.1,0.0.0.0" # Pre-install CPU-only PyTorch to save space and avoid giant CUDA downloads RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu # Copy requirements first to leverage Docker layer caching COPY requirements.txt . # Install the rest of the dependencies from requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Copy the application code COPY app.py . EXPOSE 7860 CMD ["python", "app.py"]