From 3c798d09569afeda33b154540b84c58c5cb7d453 Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Fri, 11 Jul 2025 21:04:18 -0700 Subject: [PATCH] Build and push ComfyUI -> Arm64 only build --- .gitea/workflows/build.yaml | 24 ++++++++ dockerfile | 117 +++--------------------------------- 2 files changed, 32 insertions(+), 109 deletions(-) create mode 100644 .gitea/workflows/build.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..e64c7e8 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,24 @@ +name: Docker Build and Release Upload + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: build and push comfyui + run: | + docker buildx build \ + --platform=linux/arm64 \ + -t docker.mistox.net/comfyui \ + --push \ + ./database \ No newline at end of file diff --git a/dockerfile b/dockerfile index b884428..57102d3 100644 --- a/dockerfile +++ b/dockerfile @@ -1,112 +1,6 @@ # Get cuda version from https://hub.docker.com/r/nvidia/cuda -FROM nvidia/cuda:12.9.1-devel-ubuntu20.04 AS build-deps +FROM nvcr.io/nvidia/pytorch:25.05-py3 AS build-deps -ENV TZ=Etc/UTC -ENV DEBIAN_FRONTEND=noninteractive - -# Install build dependencies -RUN apt update -y && \ - apt install -y software-properties-common && \ - add-apt-repository ppa:ubuntu-toolchain-r/test && \ - apt update && \ - apt install -y \ - curl \ - gcc-13 \ - g++-13 \ - make \ - wget \ - libffi-dev \ - libssl-dev \ - libbz2-dev \ - zlib1g-dev \ - liblzma-dev \ - libreadline-dev \ - libsqlite3-dev \ - libopenblas-dev \ - libblas-dev \ - libjpeg-dev \ - libpng-dev \ - libavcodec-dev \ - libavformat-dev \ - libswscale-dev \ - libomp-dev \ - libnuma-dev \ - m4 \ - cmake \ - git \ - ninja-build \ - libprotobuf-dev \ - protobuf-compiler \ - libeigen3-dev \ - zip \ - unzip - -# Build Python from source -FROM build-deps AS build-python -WORKDIR /usr/src - -# Get release version from https://www.python.org/downloads/source/ -ARG Python_Release=3.12.11 - -RUN wget https://www.python.org/ftp/python/${Python_Release}/Python-${Python_Release}.tgz && \ - tar xzf Python-${Python_Release}.tgz - -WORKDIR /usr/src/Python-${Python_Release} - -RUN ./configure --enable-optimizations && \ - make -j$(nproc) && \ - make altinstall - -RUN Python_Version=$(echo "$Python_Release" | cut -d. -f1,2) && \ - ln -sf /usr/local/bin/python$Python_Version /usr/bin/python && \ - ln -sf /usr/local/bin/pip$Python_Version /usr/bin/pip - -# Build pytorch from souce -FROM build-python AS clone-pytorch -WORKDIR /usr/src - -# Get release version from https://github.com/pytorch/pytorch/releases -ARG Pytorch_Release=2.7.1 -# Set the number of jobs for the Pytorch_Build -> (Gb of RAM)/17 rounded down to the nearest whole number -ARG Pytorch_Jobs=4 -# Set the CUDA arch to compile for -ARG CUDA_ARCH_LIST="7.5;8.0;8.6;8.9" - -RUN git clone --recursive -b v${Pytorch_Release} https://github.com/pytorch/pytorch.git -WORKDIR /usr/src/pytorch - -RUN python -m pip install numpy typing_extensions future sympy - -RUN pip install -r requirements.txt - -RUN git submodule sync && \ - git submodule update --init --recursive - -FROM clone-pytorch AS build-pytorch - -ENV USE_CUDA=1 \ - USE_CUDNN=1 \ - BUILD_CAFFE2=0 \ - USE_DISTRIBUTED=0 \ - USE_FBGEMM=0 \ - USE_MKLDNN=0 \ - USE_NCCL=0 \ - USE_QNNPACK=0 \ - USE_XNNPACK=0 \ - USE_OPENMP=0 \ - USE_TENSORPIPE=0 \ - USE_SYSTEM_EIGEN_INSTALL=0 \ - BUILD_TEST=0 \ - CMAKE_PREFIX_PATH="/usr/local/cuda" \ - CUDA_HOME="/usr/local/cuda" \ - USE_NVRTC=1 - -RUN MAX_JOBS=${Pytorch_Jobs} && \ - TORCH_CUDA_ARCH_LIST=${CUDA_ARCH_LIST} && \ - python setup.py install - -# Build ComfyUI from source -FROM build-pytorch AS publish WORKDIR /app # Get release version from https://github.com/comfyanonymous/ComfyUI/releases @@ -116,10 +10,15 @@ RUN wget https://github.com/comfyanonymous/ComfyUI/archive/refs/tags/v${ComfyUI_ tar xzf v${ComfyUI_Release}.tar.gz && \ rm v${ComfyUI_Release}.tar.gz && \ mv /app/ComfyUI-${ComfyUI_Release} /app/comfyui/ + WORKDIR /app/comfyui -RUN python -m pip install --upgrade pip && \ - python -m pip install -r requirements.txt +RUN ln -sf /usr/bin/python3 /usr/bin/python && \ + ln -sf /usr/bin/pip3 /usr/bin/pip + +#RUN grep -vE "^(torch|#)" requirements.txt | sed 's/==.*//' | sed 's/>=.*//' | sed 's/~=.*//' | xargs pip install +RUN grep -vE "^(torch|#)" requirements.txt | xargs pip install && \ + pip install torchsde EXPOSE 8188