Spaces:
Running
Running
Download Dockerfile from IDKHowToCodeFr/hf-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/IDKHowToCodeFr/hf-backend/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/IDKHowToCodeFr/hf-backend/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/IDKHowToCodeFr/hf-backend/resolve/main/Dockerfile
1.19 kB
| FROM python:3.11-slim | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| HF_HOME=/tmp/hf \ | |
| PORT=7860 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user && \ | |
| mkdir -p /tmp/hf /tmp/p2 && \ | |
| chown -R user:user /tmp/hf /tmp/p2 && \ | |
| chmod 777 /tmp/hf /tmp/p2 | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR /app | |
| COPY --chown=user:user requirements.txt . | |
| RUN --mount=type=secret,id=GITHUB_TOKEN,required=false,uid=1000 \ | |
| if [ -f /run/secrets/GITHUB_TOKEN ]; then \ | |
| TOKEN=$(cat /run/secrets/GITHUB_TOKEN); \ | |
| if [ -n "$TOKEN" ]; then \ | |
| git config --global url."https://${TOKEN}@github.com/".insteadOf "https://github.com/"; \ | |
| fi; \ | |
| fi && \ | |
| pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt && \ | |
| git config --global --unset-all url."https://${TOKEN}@github.com/".insteadOf 2>/dev/null || true | |
| COPY --chown=user:user . . | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |