Dockerfile 1.23 KB
Newer Older
1
FROM nvidia/cuda:12.1.0-runtime-ubuntu20.04
2
3
4
LABEL maintainer="Hugging Face"
LABEL repository="diffusers"

5
ARG PYTHON_VERSION=3.12
6
7
ENV DEBIAN_FRONTEND=noninteractive

8
9
RUN apt-get -y update \
    && apt-get install -y software-properties-common \
10
11
    && add-apt-repository ppa:deadsnakes/ppa && \
    apt-get update
12
13

RUN apt install -y bash \
14
15
16
17
18
    build-essential \
    git \
    git-lfs \
    curl \
    ca-certificates \
19
    libglib2.0-0 \
20
21
    libsndfile1-dev \
    libgl1 \
22
    python3 \
23
    python3-pip \
24
25
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*
26

27
28
29
30
31
32
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:$PATH"
ENV VIRTUAL_ENV="/opt/venv"
ENV UV_PYTHON_INSTALL_DIR=/opt/uv/python
RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
33
34

# pre-install the heavy dependencies (these can later be overridden by the deps from setup.py)
35
RUN uv pip install --no-cache-dir \
36
    torch \
37
    torchvision \
38
39
40
41
42
43
    torchaudio

RUN uv pip install --no-cache-dir "git+https://github.com/huggingface/diffusers.git@main#egg=diffusers[test]"

# Extra dependencies
RUN uv pip install --no-cache-dir \
44
    accelerate \
45
    numpy==1.26.4 \
46
    pytorch-lightning \
47
    hf_transfer
48

49
CMD ["/bin/bash"]