-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
54 lines (46 loc) · 1.59 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM python:3.11-slim-bookworm
# Install git and aria2c
RUN apt-get update \
&& apt-get install -y git \
build-essential \
gcc \
g++ \
aria2 \
libgl1 \
libglib2.0-0 \
fonts-dejavu-core \
sudo \
&& rm -rf /var/lib/apt/lists/*
# Define build argument for CUDA version with default value
ARG CUDA_VERSION=cu121
# Install torch, torchvision, torchaudio and xformers
RUN pip install --no-cache-dir --break-system-packages \
torch \
torchvision \
torchaudio \
xformers \
--index-url https://download.pytorch.org/whl/${CUDA_VERSION}
# Install onnxruntime-gpu
RUN pip uninstall --break-system-packages --yes \
onnxruntime-gpu \
&& pip install --no-cache-dir --break-system-packages \
onnxruntime-gpu \
--extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
# Install dependencies for ComfyUI and ComfyUI-Manager
RUN pip install --no-cache-dir --break-system-packages \
-r https://raw.githubusercontent.com/comfyanonymous/ComfyUI/master/requirements.txt \
-r https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/requirements.txt
# Create a low-privilege user
RUN useradd -m -d /app runner \
&& mkdir -p /scripts /workflows \
&& chown runner:runner /app /scripts /workflows
COPY --chown=runner:runner scripts/. /scripts/
COPY --chown=runner:runner workflows/. /workflows/
# Add runner to sudoers
RUN echo "runner ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/runner
USER runner:runner
VOLUME /app
WORKDIR /app
EXPOSE 8188
ENV CLI_ARGS=""
CMD ["bash","/scripts/entrypoint.sh"]