forked from blib-la/runpod-worker-comfy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
74 lines (56 loc) · 2.37 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Use Nvidia CUDA base image
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 as base
# Prevents prompts from packages asking for user input during installation
ENV DEBIAN_FRONTEND=noninteractive
# Prefer binary wheels over source distributions for faster pip installations
ENV PIP_PREFER_BINARY=1
# Ensures output from python is printed immediately to the terminal without buffering
ENV PYTHONUNBUFFERED=1
# Install Python, git and other necessary tools
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
git \
wget \
libgl1 \
libglib2.0-0 \
curl
# Clean up to reduce image size
RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
RUN pip3 install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
# RUN pip install --no-cache-dir xformers --no-deps
# RUN pip install insightface
# Clone ComfyUI repository
# RUN git clone --branch master --single-branch --depth 1 https://github.com/comfyanonymous/ComfyUI /comfyui
RUN git clone --branch master --single-branch https://github.com/comfyanonymous/ComfyUI /comfyui
RUN git clone --branch main --single-branch --depth 1 https://github.com/ltdrdata/ComfyUI-Manager /comfyui/custom_nodes/ComfyUI-Manager
# Change working directory to ComfyUI
WORKDIR /comfyui
# Install ComfyUI dependencies
RUN pip3 install -r requirements.txt
# Go back to the root
WORKDIR /
ADD requirements.txt /requirements.txt
RUN pip3 install -r /requirements.txt
# RUN pip3 install runpod requests boto3 nanoid
# Install cloudflared
RUN wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb \
&& dpkg -i cloudflared-linux-amd64.deb
# Install JupyterLab for debugging
RUN pip3 install --no-cache-dir jupyterlab
# Set the DEPS_JSON environment variable to pass comfyui snapshot
ARG DEPS_JSON
ENV DEPS_JSON=${DEPS_JSON}
ADD scripts/manager_copy.py scripts/install_custom_nodes_BASIC.py scripts/deps.json ./scripts/
ADD scripts/put_files_in_models_folder.py ./scripts/
# RUN python3 /scripts/put_files_in_models_folder.py
RUN python3 /scripts/install_custom_nodes_BASIC.py
# Add the start and the handler
ADD start.sh rp_handler.py test_input.json ./
# ADD extra_model_paths.yaml /comfyui/
ADD app/ /app/
# Expose port 8888 for JupyterLab
EXPOSE 8080 8888
RUN chmod +x /start.sh
# Start the container
CMD /start.sh