Download Dockerfile from Eng-Musa/MusAI: direct link, hf CLI and curl.
- Browser
- Download file 922 Bytes
-
https://huggingface.co/spaces/Eng-Musa/MusAI/resolve/c3be2798e8cb337993b91810f855de95dcafe3bd/Dockerfile
- Command line
-
hf download hf://spaces/Eng-Musa/MusAI@c3be2798e8cb337993b91810f855de95dcafe3bd/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Eng-Musa/MusAI/resolve/c3be2798e8cb337993b91810f855de95dcafe3bd/Dockerfile
922 Bytes
| # 1. Use Hugging Face recommended Python image | |
| FROM python:3.9 | |
| # 2. Create non-root user (required by Hugging Face Spaces) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # 3. Set working directory | |
| WORKDIR /app | |
| # 4. Install essential system dependencies | |
| # - switched to root temporarily | |
| USER root | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends gcc libpq-dev && \ | |
| rm -rf /var/lib/apt/lists/* | |
| USER user | |
| # 5. Copy requirements first for caching | |
| COPY --chown=user requirements.txt . | |
| # 6. Upgrade pip & install Python dependencies | |
| RUN python -m pip install --upgrade pip \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| # 7. Copy the rest of the app code | |
| COPY --chown=user . . | |
| # 8. Expose Hugging Face default port | |
| EXPOSE 7860 | |
| # 9. Run Uvicorn server for FastAPI app | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |