Download Dockerfile from thepaul/kicks-api: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/thepaul/kicks-api/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/thepaul/kicks-api/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/thepaul/kicks-api/resolve/main/Dockerfile
1.22 kB
| FROM python:3.11-slim | |
| # Prevent Python from writing .pyc files and buffer stdout | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| DEBIAN_FRONTEND=noninteractive | |
| # Install system deps: libsndfile for soundfile, build-essential for torch | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libsndfile1 \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create non-root user (UID 1000 required by HF Spaces Dev Mode) | |
| RUN useradd -m -u 1000 user | |
| # Install uv for faster pip installs | |
| RUN pip install --no-cache-dir uv | |
| # Install PyTorch with CUDA support (GPU Space) | |
| RUN uv pip install --system --no-cache-dir \ | |
| torch \ | |
| torchaudio \ | |
| && uv cache clean | |
| # Install app dependencies | |
| WORKDIR /app | |
| COPY --chown=user ./requirements.txt . | |
| RUN uv pip install --system --no-cache-dir -r requirements.txt \ | |
| && uv cache clean | |
| # Copy application code and model files | |
| COPY --chown=user . . | |
| # Redirect HF/torch caches to /tmp (only writable directory on Spaces) | |
| ENV HF_HOME=/tmp/hf_cache \ | |
| TORCH_HOME=/tmp/hf_cache/torch | |
| # Switch to non-root user | |
| USER user | |
| # Expose the expected HF Spaces port | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |