Spaces:
Sleeping
Sleeping
Download Dockerfile from vayu2601/project: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/spaces/vayu2601/project/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/vayu2601/project/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/vayu2601/project/resolve/main/Dockerfile
1 kB
| # Use Python 3.12 to perfectly match your local Venv | |
| FROM python:3.12-slim | |
| # Install uv inside the container for ultra-fast, predictable builds | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ | |
| # Create the user but STAY as root for the installation steps | |
| RUN useradd -m -u 1000 user | |
| WORKDIR /app | |
| # Copy requirements file (still as root) | |
| COPY ./requirements.txt requirements.txt | |
| # Dynamically strip out the windows environment suffix | |
| RUN sed -i 's/tensorflow-intel/tensorflow/g' requirements.txt | |
| # Run uv installation cleanly into the system environment using root permissions | |
| RUN uv pip install --no-cache-dir --system -r requirements.txt | |
| # Copy the rest of your application code and give ownership to the user | |
| COPY --chown=user:user . /app | |
| # NOW switch to the unprivileged user for security right before launching the app | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Hugging Face Spaces expects traffic on port 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |