Download Dockerfile from nxdev-org/oo: direct link, hf CLI and curl.
- Browser
- Download file 2.05 kB
-
https://huggingface.co/spaces/nxdev-org/oo/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/nxdev-org/oo/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/nxdev-org/oo/resolve/main/Dockerfile
2.05 kB
| FROM python:3.13-slim | |
| # Copy uv binaries from the official image | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ | |
| # Configure environments for HF Spaces (Non-root user compatibility) | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONWARNINGS=ignore \ | |
| UV_SYSTEM_PYTHON=1 \ | |
| PORT=7860 \ | |
| HOME=/home/user \ | |
| HF_HOME=/home/user/.cache/huggingface \ | |
| DATA_DIR=/home/user/data \ | |
| PIP_PORT=7000 | |
| # Create a dedicated home directory for the HF runtime user | |
| RUN mkdir -p $HOME $HF_HOME $DATA_DIR && chmod -R 777 $HOME | |
| WORKDIR $HOME/app | |
| # 1. Install system utilities (curl) and clean up apt caches to save space | |
| RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/* | |
| # 2. Install primary proxy dependencies first (Layer Caching) | |
| COPY ./requirements.txt . | |
| RUN --mount=type=cache,target=/home/user/.cache/uv \ | |
| uv pip install -r requirements.txt | |
| # 3. Copy application source code and adjust ownership | |
| COPY --chown=1000:1000 . . | |
| # 4. Spin up proxy temporarily, check health using curl, install open-webui, and shut down proxy | |
| RUN --mount=type=cache,target=/home/user/.cache/uv \ | |
| uv run python ./pypi_proxy.py --port $PIP_PORT & \ | |
| PROXY_PID=$! && \ | |
| until curl -s http://127.0.0.1:$PIP_PORT > /dev/null; do \ | |
| echo "Waiting for PyPI proxy http://127.0.0.1:$PIP_PORT to start..." && \ | |
| sleep 1; \ | |
| done && \ | |
| uv pip install --index-url http://127.0.0.1:$PIP_PORT/simple/ open-webui && \ | |
| uv pip install audioop-lts && \ | |
| uv pip uninstall -y torch && \ | |
| kill $PROXY_PID | |
| # Inject a dynamic bootloader alias mapping audioop -> audioop_lts | |
| RUN python -c "import site; import os; p = os.path.join(site.getsitepackages()[0], 'sitecustomize.py'); open(p, 'a').write('\ntry:\n import audioop_lts\n import sys\n sys.modules[\'audioop\'] = audioop_lts\nexcept ImportError:\n pass\n')" | |
| # 5. Expose the Hugging Face standard port | |
| EXPOSE 7860 | |
| # 6. Start open-webui directly | |
| CMD ["open-webui", "serve", "--port", "7860"] |