Compare commits

...

2 commits

Author SHA1 Message Date
Faptain 18a8281356
Merge dfde056a22 into 802d0bcd68 2025-11-30 02:39:02 +00:00
fapoverflow dfde056a22 Update comfyui image & add ai toolkit 2025-11-30 03:38:39 +01:00
5 changed files with 156 additions and 8 deletions

1
.gitignore vendored
View file

@ -6,3 +6,4 @@
/.vscode
.idea
TODO.md
*.env

View file

@ -77,6 +77,8 @@ services:
container_name: comfy
build: ./services/comfy
image: sd-comfy:latest
# command:
# - python main.py --preview-method auto --force-fp16
volumes:
- ./data/models:/opt/comfyui/models
- ./data/config/configs:/opt/comfyui/user/default/
@ -145,3 +147,29 @@ services:
image: sd-fooocus:latest
environment:
- CLI_ARGS=
ai-toolkit:
<<: *base_service
profiles: [ "ai-toolkit" ]
container_name: ai-toolkit
build: ./services/ai-toolkit
image: sd-aitoolkit:latest
ports:
- "8675:8675"
volumes:
- ./data/.cache/huggingface/hub:/root/.cache/huggingface/hub
# - ./data/aitk_db.db:/app/ai-toolkit/aitk_db.db
- ./data/datasets:/app/ai-toolkit/datasets
- ./data/config/ai-toolkit:/app/ai-toolkit/config
- ./data/models:/app/ai-toolkit/models
- ./output/ai-toolkit:/app/ai-toolkit/output
environment:
- AI_TOOLKIT_AUTH=${AI_TOOLKIT_AUTH:-password}
- NODE_ENV=production
- TZ=UTC
secrets:
- my_secret
secrets:
my_secret:
file: ./services/ai-toolkit/secret.env

View file

@ -0,0 +1,7 @@
FROM ostris/aitoolkit:latest
ADD --chmod=755 entrypoint.sh /docker/
ENTRYPOINT ["/bin/bash", "/docker/entrypoint.sh"]
CMD ["/start.sh"]

View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# get envs files and export envars
export $(egrep -v '^#' /run/secrets/* | xargs)
# if need some specific file, where password is the secret name
# export $(egrep -v '^#' /run/secrets/password| xargs)
# call the dockerfile's entrypoint
source /start.sh

View file

@ -1,7 +1,9 @@
# Defines the versions of ComfyUI, ComfyUI Manager, and PyTorch to use
ARG COMFYUI_VERSION=v0.3.59
ARG COMFYUI_MANAGER_VERSION=3.35
ARG PYTORCH_VERSION=2.8.0-cuda12.9-cudnn9-runtime
ARG COMFYUI_VERSION=v0.3.71
#ARG COMFYUI_MANAGER_VERSION=3.35
ARG PYTORCH_VERSION=2.9.1-cuda13.0-cudnn9-devel
# number of CPU's use for compilation
ARG CPUS=10
# This image is based on the latest official PyTorch image, because it already contains CUDA, CuDNN, and PyTorch
FROM pytorch/pytorch:${PYTORCH_VERSION}
@ -17,7 +19,42 @@ RUN apt update --assume-yes && \
libglib2.0-0 \
libsm6 \
libxext6 \
ffmpeg && \
autoconf \
automake \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
libmp3lame-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
meson \
ninja-build \
pkg-config \
texinfo \
wget \
yasm \
zlib1g-dev \
nasm \
libunistring-dev \
libaom-dev \
libx265-dev \
libx264-dev \
libnuma-dev \
libfdk-aac-dev \
libc6 \
libc6-dev \
unzip \
libnuma1 \
# ffmpeg \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
@ -34,9 +71,10 @@ RUN git clone --depth=1 https://github.com/comfyanonymous/ComfyUI.git /opt/comfy
# this directory is mounted as a volume, so that the custom nodes are not installed inside of the container and are not lost when the container is
# removed; this way, the custom nodes are installed on the host machine
RUN git clone --depth=1 https://github.com/Comfy-Org/ComfyUI-Manager.git /opt/comfyui-manager && \
cd /opt/comfyui-manager && \
git fetch origin ${COMFYUI_MANAGER_VERSION} && \
git checkout FETCH_HEAD
cd /opt/comfyui-manager
# cd /opt/comfyui-manager && \
# git fetch origin ${COMFYUI_MANAGER_VERSION} && \
# git checkout FETCH_HEAD
# Installs the required Python packages for both ComfyUI and the ComfyUI Manager
RUN pip install \
@ -47,8 +85,75 @@ RUN pip3 install --no-cache-dir \
opencv-python \
diffusers \
triton \
torchsde \
nvidia-ml-py \
sageattention \
psutil
flash-attention \
psutil \
nvitop
# compile ffmpeg
RUN mkdir -p ~/ffmpeg_sources ~/bin && \
cd ~/ffmpeg_sources && \
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
tar xjvf ffmpeg-snapshot.tar.bz2 && \
cd ffmpeg && \
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--ld="g++" \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-gnutls \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree && \
PATH="$HOME/bin:$PATH" make -j $CPUS && \
make install && \
hash -r
# install ffmpeg-nvidia adapter
RUN mkdir ~/nv && cd ~/nv && \
git clone https://github.com/FFmpeg/nv-codec-headers.git && \
cd nv-codec-headers && make install
# compile ffmpeg with cuda
RUN cd ~/nv && \
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/ && \
cd ffmpeg && \
./configure \
--enable-nonfree \
--enable-nvenc \
--enable-cuda \
--enable-cuda-nvcc \
--enable-cuvid \
--extra-cflags=-I/usr/local/cuda/include \
--extra-ldflags=-L/usr/local/cuda/lib64 \
--disable-static \
--enable-gpl \
--enable-gnutls \
--enable-shared \
--enable-libaom \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libvorbis \
--enable-libx264 \
--enable-libx265 \
# --enable-libnpp \ # ERROR: libnpp support is deprecated, version 13.0 and up are not supported \
# --enable-libopus \ # not found : install ?
# --enable-libvpx \
&& \
make -j $CPUS && \
make install
# Pre-install previously used custom nodes requirements from volume
COPY ./install/merged-requirements.txt* /docker/requirements.txt