Download Dockerfile from wilooper/musivapi: direct link, hf CLI and curl.
- Browser
- Download file 2.95 kB
-
https://huggingface.co/spaces/wilooper/musivapi/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/wilooper/musivapi/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/wilooper/musivapi/resolve/main/Dockerfile
2.95 kB
| # ββ Base image ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| FROM python:3.11-slim | |
| # ββ System deps βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # curl β healthcheck only (no ffmpeg needed without download feature) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ββ Working directory βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| WORKDIR /app | |
| # ββ Python deps β separate layer so code changes don't bust the cache βββββββββ | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| # ββ App code ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| COPY app.py ./ | |
| # ββ Ensure tmp dirs exist and are writable ββββββββββββββββββββββββββββββββββββ | |
| RUN mkdir -p /tmp/ytm_cache \ | |
| && chmod -R 777 /tmp/ytm_cache | |
| # ββ Hugging Face Spaces runs as a non-root user βββββββββββββββββββββββββββββββ | |
| RUN chmod -R 755 /app | |
| # ββ Expose port 7860 (required by HF Spaces) βββββββββββββββββββββββββββββββββ | |
| EXPOSE 7860 | |
| # ββ Health check ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ | |
| CMD curl -f http://localhost:7860/health || exit 1 | |
| # ββ Start server ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Single worker: in-memory chart cache (_cache_charts) is process-local. | |
| # With 1 worker all requests share the same 10-hour chart cache. | |
| # Disk cache (diskcache) provides durability across restarts. | |
| # uvloop + httptools come in via uvicorn[standard]. | |
| CMD ["uvicorn", "app:app", \ | |
| "--host", "0.0.0.0", \ | |
| "--port", "7860", \ | |
| "--workers", "1", \ | |
| "--loop", "uvloop", \ | |
| "--http", "httptools", \ | |
| "--timeout-keep-alive", "120", \ | |
| "--access-log"] | |