Spaces:
Running
Running
Download Dockerfile from MarneMorgan/OpenAI-style-API: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/MarneMorgan/OpenAI-style-API/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/MarneMorgan/OpenAI-style-API/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/MarneMorgan/OpenAI-style-API/resolve/main/Dockerfile
1.02 kB
| FROM ollama/ollama:latest | |
| # ---- system deps ---- | |
| USER root | |
| RUN apt-get update && apt-get install -y \ | |
| python3 python3-pip python3-venv \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ---- app directory ---- | |
| WORKDIR /home/app | |
| # ---- python venv (as root) ---- | |
| RUN python3 -m venv /home/app/venv | |
| # ---- ensure HF UID exists ---- | |
| RUN if ! getent passwd 1000 >/dev/null; then useradd -m -u 1000 appuser; fi | |
| # ---- permissions ---- | |
| RUN chown -R 1000:1000 /home/app | |
| # ---- switch user by UID (most robust) ---- | |
| USER 1000 | |
| # ---- env ---- | |
| ENV HOME=/home/app \ | |
| PATH=/home/app/venv/bin:$PATH \ | |
| OLLAMA_KEEP_ALIVE=30m \ | |
| OLLAMA_LOAD_TIMEOUT=10m \ | |
| OLLAMA_NUM_PARALLEL=1 \ | |
| OLLAMA_MAX_QUEUE=64 \ | |
| OLLAMA_CONTEXT_LENGTH=4096 | |
| # ---- copy app ---- | |
| COPY . . | |
| # ---- install deps ---- | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| EXPOSE 7860 | |
| # ๐ CRITICAL: clear Ollama ENTRYPOINT | |
| ENTRYPOINT [] | |
| # ---- run app ---- | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] |