Download Dockerfile from dormant78612/nextgenyeild-api: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/spaces/dormant78612/nextgenyeild-api/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/dormant78612/nextgenyeild-api/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/dormant78612/nextgenyeild-api/resolve/main/Dockerfile
1.4 kB
| FROM python:3.11-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Hugging Face Spaces requirement: user with UID 1000 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| PYTHONUNBUFFERED=1 \ | |
| PORT=7860 | |
| WORKDIR $HOME/app | |
| # Install PyTorch CPU wheels first (keeps container lightweight & builds fast) | |
| RUN pip install --no-cache-dir torch==2.5.1 torchvision --index-url https://download.pytorch.org/whl/cpu | |
| # Copy and install Python requirements | |
| COPY --chown=user:user requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application source code | |
| COPY --chown=user:user . . | |
| # Ensure internal dinov2 import symlink exists | |
| RUN ln -sf FoMo4Wheat dinov2 | |
| # Auto-download the FoMo4Wheat foundation backbone during Docker build if not present | |
| RUN python -c "from pathlib import Path; import urllib.request; p = Path('weight/FoMo4Wheat_base.pth'); p.parent.mkdir(parents=True, exist_ok=True); (not p.exists()) and (print('Downloading FoMo4Wheat_base.pth (~346MB)...'), urllib.request.urlretrieve('https://huggingface.co/PheniX-Lab/FoMo4Wheat/resolve/main/weight/FoMo4Wheat_base.pth', str(p)), print('Download finished!'))" | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"] | |