-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDockerfile
More file actions
128 lines (99 loc) · 4.13 KB
/
Copy pathDockerfile
File metadata and controls
128 lines (99 loc) · 4.13 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Set the base image
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
# Set the shell and enable pipefail for better error handling
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Set basic environment variables
ARG PYTHON_VERSION
ARG TORCH_VERSION
ARG CUDA_VERSION
ARG SKIP_CUSTOM_NODES
# Set basic environment variables
ENV SHELL=/bin/bash
ENV PYTHONUNBUFFERED=True
ENV DEBIAN_FRONTEND=noninteractive
# Set the default workspace directory
ENV RP_WORKSPACE=/workspace
# Override the default huggingface cache directory.
ENV HF_HOME="${RP_WORKSPACE}/.cache/huggingface/"
# Faster transfer of models from the hub to the container
ENV HF_HUB_ENABLE_HF_TRANSFER=1
ENV HF_XET_HIGH_PERFORMANCE=1
# Shared python package cache
ENV VIRTUALENV_OVERRIDE_APP_DATA="${RP_WORKSPACE}/.cache/virtualenv/"
ENV PIP_CACHE_DIR="${RP_WORKSPACE}/.cache/pip/"
ENV UV_CACHE_DIR="${RP_WORKSPACE}/.cache/uv/"
# modern pip workarounds
ENV PIP_BREAK_SYSTEM_PACKAGES=1
ENV PIP_ROOT_USER_ACTION=ignore
# Set TZ and Locale
ENV TZ=Etc/UTC
# Set working directory
WORKDIR /
# Update and upgrade
RUN apt-get update --yes && \
apt-get upgrade --yes
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
# Install essential packages
RUN apt-get install --yes --no-install-recommends \
git wget curl bash nginx-light rsync sudo binutils ffmpeg lshw nano tzdata file build-essential cmake nvtop \
libgl1 libglib2.0-0 clang libomp-dev ninja-build \
openssh-server ca-certificates && \
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
# Install the UV tool from astral-sh
ADD https://astral.sh/uv/install.sh /uv-installer.sh
RUN sh /uv-installer.sh && rm /uv-installer.sh
ENV PATH="/root/.local/bin/:$PATH"
# Install Python and create virtual environment
RUN uv python install ${PYTHON_VERSION} --default --preview && \
uv venv --seed /venv
ENV PATH="/workspace/venv/bin:/venv/bin:$PATH"
# Install essential Python packages and dependencies
RUN pip install --no-cache-dir -U \
pip setuptools wheel \
jupyterlab jupyterlab_widgets ipykernel ipywidgets \
huggingface_hub hf_transfer \
numpy scipy matplotlib pandas scikit-learn seaborn requests tqdm pillow pyyaml \
triton \
torch==${TORCH_VERSION} torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/${CUDA_VERSION}
# Install ComfyUI and ComfyUI Manager
RUN git clone https://github.com/comfyanonymous/ComfyUI.git && \
cd ComfyUI && \
pip install --no-cache-dir -r requirements.txt && \
git clone https://github.com/ltdrdata/ComfyUI-Manager.git custom_nodes/ComfyUI-Manager && \
cd custom_nodes/ComfyUI-Manager && \
pip install --no-cache-dir -r requirements.txt
COPY custom_nodes.txt /custom_nodes.txt
RUN if [ -z "$SKIP_CUSTOM_NODES" ]; then \
cd /ComfyUI/custom_nodes && \
xargs -n 1 git clone --recursive < /custom_nodes.txt && \
find /ComfyUI/custom_nodes -name "requirements.txt" -exec pip install --no-cache-dir -r {} \; && \
find /ComfyUI/custom_nodes -name "install.py" -exec python {} \; ; \
else \
echo "Skipping custom nodes installation because SKIP_CUSTOM_NODES is set"; \
fi
# Install Runpod CLI
#RUN wget -qO- cli.runpod.net | sudo bash
# Install code-server
RUN curl -fsSL https://code-server.dev/install.sh | sh
EXPOSE 22 3000 8080 8888
# NGINX Proxy
COPY proxy/nginx.conf /etc/nginx/nginx.conf
COPY proxy/snippets /etc/nginx/snippets
COPY proxy/readme.html /usr/share/nginx/html/readme.html
# Remove existing SSH host keys
RUN rm -f /etc/ssh/ssh_host_*
# Copy the README.md
COPY README.md /usr/share/nginx/html/README.md
# Start Scripts
COPY --chmod=755 scripts/start.sh /
COPY --chmod=755 scripts/pre_start.sh /
COPY --chmod=755 scripts/post_start.sh /
COPY --chmod=755 scripts/download_presets.sh /
COPY --chmod=755 scripts/install_custom_nodes.sh /
# Welcome Message
COPY logo/runpod.txt /etc/runpod.txt
RUN echo 'cat /etc/runpod.txt' >> /root/.bashrc
RUN echo 'echo -e "\nFor detailed documentation and guides, please visit:\n\033[1;34mhttps://docs.runpod.io/\033[0m and \033[1;34mhttps://blog.runpod.io/\033[0m\n\n"' >> /root/.bashrc
# Set entrypoint to the start script
CMD ["/start.sh"]