FROM python:3.10-slim # Install dependencies RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* # Install Python packages RUN pip install --no-cache-dir torch transformers flask kernels accelerate huggingface_hub # Create cache dir for Hugging Face models RUN mkdir -p /app/model_cache ENV HF_HOME=/app/model_cache # Download GPT-OSS-20B at build time RUN python -c "from huggingface_hub import snapshot_download; snapshot_download('openai/gpt-oss-20b', cache_dir='/app/model_cache', resume_download=True)" # Copy app code WORKDIR /app COPY app.py /app RUN chmod -R 777 /app # Expose port and start app EXPOSE 7860 CMD ["python", "app.py"]