NatureLM-Audio / Dockerfile
gagannarula's picture
Build HF app as UID 1000 so runtime user owns .venv
2c83848
Raw
History Blame Contribute Delete
1.32 kB
FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV UV_NO_DEV=1
ENV UV_NO_CACHE=1
ENV GRADIO_ANALYTICS_ENABLED="False"
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
RUN apt-get update && apt-get install -y \
git \
git-lfs \
ffmpeg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& git lfs install
# HF Spaces runs the container as a non-root user (UID 1000) at runtime. Create
# that user and build everything under it so it owns the .venv and can execute
# /app/esp-research/.venv/bin/python3.
RUN useradd -m -u 1000 user
RUN mkdir -p /app && chown -R user:user /app
USER user
ENV HOME=/home/user
RUN --mount=type=secret,id=GH_TOKEN,mode=0444,required=true \
git -c "http.https://github.com/.extraheader=Authorization: Basic $(printf 'x-access-token:%s' "$(cat /run/secrets/GH_TOKEN)" | base64 | tr -d '\n')" \
clone --single-branch --depth 1 https://github.com/earthspecies/esp-research.git /app/esp-research
# alp-data is now published on PyPI and pinned in esp-research's pyproject.toml,
# so uv sync resolves it directly -- no separate clone needed.
WORKDIR /app/esp-research
RUN uv sync --frozen
WORKDIR /app/esp-research/projects/NatureLM-audio-hf-app
EXPOSE 7860
CMD ["uv", "run", "app.py"]