Download Dockerfile from nexusbert/F1: direct link, hf CLI and curl.
- Browser
- Download file 2.04 kB
-
https://huggingface.co/spaces/nexusbert/F1/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/nexusbert/F1/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/nexusbert/F1/resolve/main/Dockerfile
2.04 kB
| # Base Image | |
| FROM python:3.10-slim | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 | |
| WORKDIR /code | |
| # System Dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| git \ | |
| curl \ | |
| libopenblas-dev \ | |
| libomp-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements and install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Hugging Face + model tools | |
| RUN pip install --no-cache-dir huggingface-hub sentencepiece accelerate | |
| # Hugging Face cache environment | |
| ENV HF_HOME=/models/huggingface \ | |
| TRANSFORMERS_CACHE=/models/huggingface \ | |
| HUGGINGFACE_HUB_CACHE=/models/huggingface \ | |
| HF_HUB_CACHE=/models/huggingface | |
| # Created cache dir and set permissions | |
| RUN mkdir -p /models/huggingface && chmod -R 777 /models/huggingface | |
| # Pre-download models at build time (sports predictor specific models) | |
| RUN python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='valhalla/distilbart-mnli-12-1')" \ | |
| && python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='google/flan-t5-base')" \ | |
| && python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='sentence-transformers/all-MiniLM-L6-v2')" \ | |
| && find /models/huggingface -name '*.lock' -delete | |
| # Preload tokenizers (avoid runtime delays) | |
| RUN python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('valhalla/distilbart-mnli-12-1', use_fast=True)" \ | |
| && python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('google/flan-t5-base', use_fast=True)" \ | |
| && python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('sentence-transformers/all-MiniLM-L6-v2', use_fast=True)" | |
| # Copy project files | |
| COPY . . | |
| # Expose FastAPI port | |
| EXPOSE 7860 | |
| # Run FastAPI app with uvicorn (1 workers for concurrency) | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |