Spaces:
Sleeping
Sleeping
Download Dockerfile from Clario-Org/ClarioPracticeModule: direct link, hf CLI and curl.
- Browser
- Download file 952 Bytes
-
https://huggingface.co/spaces/Clario-Org/ClarioPracticeModule/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Clario-Org/ClarioPracticeModule/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Clario-Org/ClarioPracticeModule/resolve/main/Dockerfile
952 Bytes
| # 1. Base Image: Python 3.9 Slim (Small & Fast) | |
| FROM python:3.9-slim | |
| # 2. Set Working Directory inside container | |
| WORKDIR /code | |
| # 3. Copy Requirements first (optimizes build cache) | |
| COPY ./requirements.txt /code/requirements.txt | |
| # 4. Install Dependencies | |
| # --no-cache-dir keeps the image small | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # 5. Set up the "user" (Hugging Face Security Requirement) | |
| # Spaces requires the app to run as user ID 1000, not root. | |
| RUN useradd -m -u 1000 user | |
| # Switch to non-root user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # 6. Copy the rest of the application code | |
| # --chown=user ensures the non-root user owns the files | |
| COPY --chown=user . /code | |
| # 7. Expose the standard Spaces port | |
| EXPOSE 7860 | |
| # 8. Start the API | |
| # CRITICAL FIX: "main:app" matches your file structure where main.py is at the root | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |