Comfyui / Dockerfile
newturok's picture
Create Dockerfile
70221ee verified
raw
history blame
1.86 kB
ARG CUDA_VERSION="12.1.1"
ARG CUDNN_VERSION="8"
ARG UBUNTU_VERSION="22.04"
ARG DOCKER_FROM=nvidia/cuda:$CUDA_VERSION-cudnn$CUDNN_VERSION-devel-ubuntu$UBUNTU_VERSION
# Base NVidia CUDA Ubuntu image
FROM $DOCKER_FROM AS base
# Install Python plus openssh, which is our minimum set of required packages.
RUN apt-get update -y && \
apt-get install -y python3 python3-pip python3-venv && \
apt-get install -y --no-install-recommends openssh-server openssh-client git git-lfs wget vim zip unzip curl && \
python3 -m pip install --upgrade pip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install nginx
RUN apt-get update && \
apt-get install -y nginx
# Copy the 'default' configuration file to the appropriate location
COPY default /etc/nginx/sites-available/default
ENV PATH="/usr/local/cuda/bin:${PATH}"
# Install pytorch
ARG PYTORCH="2.4.0"
ARG CUDA="121"
RUN pip3 install --no-cache-dir -U torch==$PYTORCH torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu$CUDA
COPY --chmod=755 start-ssh-only.sh /start.sh
COPY --chmod=755 start-original.sh /start-original.sh
COPY --chmod=755 comfyui-on-workspace.sh /comfyui-on-workspace.sh
COPY --chmod=755 ai-toolkit-on-workspace.sh /ai-toolkit-on-workspace.sh
COPY --chmod=755 check_files.sh /check_files.sh
# Clone the git repo and install requirements in the same RUN command to ensure they are in the same layer
RUN git clone https://github.com/comfyanonymous/ComfyUI.git && \
cd ComfyUI && \
pip3 install -r requirements.txt && \
cd custom_nodes && \
git clone https://github.com/ltdrdata/ComfyUI-Manager.git && \
git clone https://github.com/pythongosssss/ComfyUI-Custom-Scripts.git && \
cd /ComfyUI && \
mkdir pysssss-workflows
COPY --chmod=755 start.sh /start.sh
WORKDIR /workspace
EXPOSE 8188
CMD [ "/start.sh" ]