|
|
FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04 |
|
|
|
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ |
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive \ |
|
|
TZ=Europe/Paris |
|
|
|
|
|
|
|
|
|
|
|
RUN rm -f /etc/apt/sources.list.d/*.list && \ |
|
|
apt-get update && apt-get install -y --no-install-recommends \ |
|
|
curl \ |
|
|
ca-certificates \ |
|
|
sudo \ |
|
|
git \ |
|
|
wget \ |
|
|
procps \ |
|
|
git-lfs \ |
|
|
zip \ |
|
|
unzip \ |
|
|
htop \ |
|
|
vim \ |
|
|
nano \ |
|
|
bzip2 \ |
|
|
libx11-6 \ |
|
|
build-essential \ |
|
|
libsndfile-dev \ |
|
|
software-properties-common \ |
|
|
python3-distutils \ |
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN add-apt-repository ppa:flexiondotorg/nvtop && \ |
|
|
apt-get upgrade -y && \ |
|
|
apt-get install -y --no-install-recommends nvtop |
|
|
|
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \ |
|
|
&& chown -R user:user /app |
|
|
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user |
|
|
USER user |
|
|
|
|
|
|
|
|
ENV HOME=/home/user |
|
|
RUN mkdir $HOME/.cache $HOME/.config \ |
|
|
&& chmod -R 777 $HOME |
|
|
|
|
|
|
|
|
WORKDIR $HOME/app |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
USER root |
|
|
|
|
|
|
|
|
|
|
|
RUN --mount=target=/root/packages.txt,source=packages.txt \ |
|
|
apt-get update && \ |
|
|
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \ |
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN curl -fsSL https://ollama.com/install.sh | sh |
|
|
|
|
|
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \ |
|
|
bash /root/on_startup.sh |
|
|
|
|
|
RUN mkdir /data && chown user:user /data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
USER user |
|
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/uv \ |
|
|
--mount=type=bind,source=uv.lock,target=uv.lock \ |
|
|
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ |
|
|
uv sync --locked --no-install-project |
|
|
|
|
|
RUN uv run ipython kernel install --user --env VIRTUAL_ENV $(pwd)/.venv --name=uv_project |
|
|
|
|
|
|
|
|
|
|
|
COPY --chown=user . $HOME/app |
|
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/uv \ |
|
|
uv sync --locked |
|
|
|
|
|
ENV PYTHONUNBUFFERED=1 \ |
|
|
SYSTEM=spaces \ |
|
|
SHELL=/bin/bash |
|
|
|
|
|
RUN chmod +x start_server.sh |
|
|
EXPOSE 7860 |
|
|
|
|
|
CMD ["./start_server.sh"] |
|
|
|