Skip to content

Commit

Permalink
Merge pull request #15 from mmartial/basedir
Browse files Browse the repository at this point in the history
20250202 release
  • Loading branch information
mmartial authored Feb 3, 2025
2 parents d7250c0 + fac7e65 commit 1e12c20
Show file tree
Hide file tree
Showing 9 changed files with 303 additions and 64 deletions.
86 changes: 86 additions & 0 deletions Dockerfile/Dockerfile-ubuntu24_cuda12.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
FROM nvidia/cuda:12.8.0-runtime-ubuntu24.04

# Adapted from https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.8.0/ubuntu2404/devel/cudnn/Dockerfile
ENV NV_CUDNN_VERSION=9.7.0.66-1
ENV NV_CUDNN_PACKAGE_NAME="libcudnn9-cuda-12"
ENV NV_CUDNN_PACKAGE="libcudnn9-cuda-12=${NV_CUDNN_VERSION}"

LABEL com.nvidia.cudnn.version="${NV_CUDNN_VERSION}"

RUN apt-get update && apt-get install -y --no-install-recommends \
${NV_CUDNN_PACKAGE} \
&& apt-mark hold ${NV_CUDNN_PACKAGE_NAME}

ARG BASE_DOCKER_FROM=nvidia/cuda:12.8.0-runtime-ubuntu24.04
##### Base

# Install system packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y --fix-missing\
&& apt-get install -y \
apt-utils \
locales \
ca-certificates \
&& apt-get upgrade -y \
&& apt-get clean

# UTF-8
RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG=en_US.utf8
ENV LC_ALL=C

# Install needed packages
RUN apt-get update -y --fix-missing \
&& apt-get upgrade -y \
&& apt-get install -y \
build-essential \
python3-dev \
unzip \
wget \
zip \
zlib1g \
zlib1g-dev \
gnupg \
rsync \
python3-pip \
python3-venv \
git \
sudo \
# Adding libGL (used by a few common nodes)
libgl1 \
libglib2.0-0 \
# Adding FFMPEG (for video generation workflow)
ffmpeg \
&& apt-get clean

ENV BUILD_FILE="/etc/image_base.txt"
ARG BASE_DOCKER_FROM
RUN echo "DOCKER_FROM: ${BASE_DOCKER_FROM}" | tee ${BUILD_FILE}
RUN echo "CUDNN: ${NV_CUDNN_PACKAGE_NAME} (${NV_CUDNN_VERSION})" | tee -a ${BUILD_FILE}

ARG BUILD_BASE="unknown"
LABEL comfyui-nvidia-docker-build-from=${BUILD_BASE}
RUN it="/etc/build_base.txt"; echo ${BUILD_BASE} > $it && chmod 555 $it

##### ComfyUI preparation
# The comfy user will have UID 1024 and GID 1024
ENV COMFYUSER_DIR="/comfy"
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
&& useradd -u 1024 -U -d ${COMFYUSER_DIR} -s /bin/bash -m comfy \
&& usermod -G users comfy \
&& adduser comfy sudo \
&& test -d ${COMFYUSER_DIR}
RUN it="/etc/comfyuser_dir"; echo ${COMFYUSER_DIR} > $it && chmod 555 $it

ENV NVIDIA_VISIBLE_DEVICES=all

EXPOSE 8188

USER comfy
WORKDIR ${COMFYUSER_DIR}
COPY --chown=comfy:comfy --chmod=555 init.bash comfyui-nvidia_init.bash

ARG BUILD_DATE="unknown"
LABEL comfyui-nvidia-docker-build=${BUILD_DATE}

CMD [ "./comfyui-nvidia_init.bash" ]
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ DOCKER_BUILD_ARGS=
##DOCKER_BUILD_ARGS="--no-cache"

#BUILD_DATE=$(shell printf '%(%Y%m%d)T' -1)
BUILD_DATE=20250116
BUILD_DATE=20250202

COMFYUI_CONTAINER_NAME=comfyui-nvidia-docker

COMPONENTS_DIR=components
DOCKERFILE_DIR=Dockerfile

# Get the list of all the base- files in COMPONENTS_DIR
DOCKER_ALL=$(shell ls -1 ${COMPONENTS_DIR}/base-* | perl -pe 's%^.+/base-%%' | sort)
#DOCKER_ALL=$(shell ls -1 ${COMPONENTS_DIR}/base-* | perl -pe 's%^.+/base-%%' | perl -pe 's%\.Dockerfile%%' | sort)
# Remove CUDA 12.8 entries for the time being
DOCKER_ALL=$(shell ls -1 ${COMPONENTS_DIR}/base-* | perl -pe 's%^.+/base-%%' | perl -pe 's%\.Dockerfile%%' | sort | grep -v 12.8)

all:
@if [ `echo ${DOCKER_ALL} | wc -w` -eq 0 ]; then echo "No images candidates to build"; exit 1; fi
Expand All @@ -31,8 +33,8 @@ ${DOCKERFILE_DIR}:

${DOCKER_ALL}: ${DOCKERFILE_DIR}
@echo ""; echo ""; echo "===== Building ${COMFYUI_CONTAINER_NAME}:$@"
@cat ${COMPONENTS_DIR}/base-$@ > ${DOCKERFILE_DIR}/Dockerfile-$@
@cat ${COMPONENTS_DIR}/part1-common >> ${DOCKERFILE_DIR}/Dockerfile-$@
@cat ${COMPONENTS_DIR}/base-$@.Dockerfile > ${DOCKERFILE_DIR}/Dockerfile-$@
@cat ${COMPONENTS_DIR}/part1-common.Dockerfile >> ${DOCKERFILE_DIR}/Dockerfile-$@
@$(eval VAR_NT="${COMFYUI_CONTAINER_NAME}-$@")
@echo "-- Docker command to be run:"
@echo "docker buildx ls | grep -q ${COMFYUI_CONTAINER_NAME} && echo \"builder already exists -- to delete it, use: docker buildx rm ${COMFYUI_CONTAINER_NAME}\" || docker buildx create --name ${COMFYUI_CONTAINER_NAME}" > ${VAR_NT}.cmd
Expand Down Expand Up @@ -82,7 +84,11 @@ docker_rmi:
############################################### For maintainer only
###### push -- will only proceed with existing ("present") images

# user the highest numbered entry
LATEST_ENTRY=$(shell echo ${DOCKER_ALL} | sed -e 's/ /\n/g' | tail -1)
# use the previous to last entry as the candidate (12.8 is for 50xx series GPUs, the driver is still beta)
#LATEST_ENTRY=$(shell echo ${DOCKER_ALL} | sed -e 's/ /\n/g' | tail -2 | head -1)

LATEST_CANDIDATE=$(shell echo ${COMFYUI_CONTAINER_NAME}:${LATEST_ENTRY})

docker_tag:
Expand Down
Loading

0 comments on commit 1e12c20

Please sign in to comment.