This commit is contained in:
+52
-23
@@ -4,12 +4,11 @@ FROM ubuntu:26.04 AS reqs
|
|||||||
ENV PIP_BREAK_SYSTEM_PACKAGES=1
|
ENV PIP_BREAK_SYSTEM_PACKAGES=1
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
# Set path variables
|
|
||||||
ENV ROCM_PATH=/usr
|
|
||||||
ENV HIP_PATH=/usr
|
|
||||||
# Install libraries
|
# Install libraries
|
||||||
RUN apt update -y && \
|
RUN apt update -y && \
|
||||||
|
apt upgrade -y && \
|
||||||
apt install -y --no-install-recommends \
|
apt install -y --no-install-recommends \
|
||||||
|
ca-certificates \
|
||||||
rocm \
|
rocm \
|
||||||
hipcc \
|
hipcc \
|
||||||
libhipblaslt-dev \
|
libhipblaslt-dev \
|
||||||
@@ -20,41 +19,69 @@ RUN apt update -y && \
|
|||||||
build-essential \
|
build-essential \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
libncurses5-dev \
|
libncurses5-dev \
|
||||||
|
libopenblas-dev \
|
||||||
|
libpthreadpool-dev \
|
||||||
|
libgoogle-glog-dev \
|
||||||
|
libgtest-dev \
|
||||||
|
libbenchmark-dev \
|
||||||
libgdbm-dev \
|
libgdbm-dev \
|
||||||
libnss3-dev \
|
libnss3-dev \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
libreadline-dev \
|
libreadline-dev \
|
||||||
libffi-dev \
|
libffi-dev \
|
||||||
libsqlite3-dev \
|
libsqlite3-dev \
|
||||||
|
libnuma-dev \
|
||||||
|
libelf-dev \
|
||||||
|
libpciaccess-dev \
|
||||||
|
protobuf-compiler \
|
||||||
|
libprotobuf-dev \
|
||||||
wget \
|
wget \
|
||||||
libbz2-dev \
|
libbz2-dev \
|
||||||
liblzma-dev \
|
liblzma-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Build python3.12
|
|
||||||
FROM reqs AS python312
|
# Build python
|
||||||
WORKDIR /build/python312
|
FROM reqs AS python
|
||||||
RUN wget https://www.python.org/ftp/python/3.12.9/Python-3.12.9.tgz && \
|
WORKDIR /build/python
|
||||||
tar -xf Python-3.12.9.tgz && \
|
RUN wget https://www.python.org/ftp/python/3.11.15/Python-3.11.15.tgz && \
|
||||||
cd Python-3.12.9 && \
|
tar -xf Python-3.11.15.tgz && \
|
||||||
./configure --enable-optimizations && \
|
cd Python-3.11.15 && \
|
||||||
|
./configure --enable-optimizations --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" && \
|
||||||
make -j 80 && \
|
make -j 80 && \
|
||||||
make install && \
|
make install && \
|
||||||
|
ldconfig /usr/local/lib && \
|
||||||
wget https://bootstrap.pypa.io/get-pip.py && \
|
wget https://bootstrap.pypa.io/get-pip.py && \
|
||||||
python3 get-pip.py && \
|
python3 get-pip.py && \
|
||||||
ln -s /usr/local/bin/pip3 /bin/pip && \
|
ln -s /usr/local/bin/pip3 /bin/pip && \
|
||||||
ln -s /usr/local/bin/pip3 /bin/pip3 && \
|
ln -s /usr/local/bin/pip3 /bin/pip3 && \
|
||||||
ln -s /usr/local/bin/python3 /bin/python && \
|
ln -s /usr/local/bin/python3 /bin/python && \
|
||||||
ln -s /usr/local/bin/python3 /bin/python3.12
|
ln -s /usr/local/bin/python3 /bin/python3.11
|
||||||
|
|
||||||
|
|
||||||
# Build pytorch
|
# Build pytorch
|
||||||
FROM python312 AS pytorch
|
FROM python AS pytorch
|
||||||
ENV CMAKE_ARGS="$CMAKE_ARGS -DUSE_KINETO=OFF"
|
# Setup Envronment
|
||||||
ENV PYTORCH_ROCM_ARCH=1100
|
ENV PYTORCH_ROCM_ARCH=1100
|
||||||
ENV USE_ROCM=1
|
ENV USE_ROCM=1
|
||||||
ENV USE_CUDA=0
|
ENV USE_CUDA=0
|
||||||
|
ENV USE_AOTRITON=0
|
||||||
|
ENV USE_SYSTEM_PTHREADPOOL=1
|
||||||
|
ENV USE_SYSTEM_PROTOC=1
|
||||||
|
ENV USE_ONNX=OFF
|
||||||
|
ENV BUILD_CUSTOM_PROTOBUF=OFF
|
||||||
|
ENV USE_XNNPACK=OFF
|
||||||
|
ENV USE_XNNPACK=OFF
|
||||||
|
ENV USE_QNNPACK=OFF
|
||||||
|
ENV USE_PYTORCH_QNNPACK=OFF
|
||||||
|
ENV USE_NNPACK=OFF
|
||||||
|
ENV USE_KINETO=OFF
|
||||||
|
ENV USE_OPENMP=OFF
|
||||||
|
ENV USE_TENSORPIPE=OFF
|
||||||
ENV ROCM_PATH=/usr
|
ENV ROCM_PATH=/usr
|
||||||
|
ENV MAX_JOBS=12
|
||||||
ENV DEVICE_LIB_PATH=/usr/lib/llvm-21/lib/clang/21/amdgcn/bitcode
|
ENV DEVICE_LIB_PATH=/usr/lib/llvm-21/lib/clang/21/amdgcn/bitcode
|
||||||
|
ENV HIPFLAGS="--rocm-device-lib-path=$DEVICE_LIB_PATH"
|
||||||
ENV CMAKE_ARGS="-DCMAKE_HIP_COMPILER_WORKS=1 \
|
ENV CMAKE_ARGS="-DCMAKE_HIP_COMPILER_WORKS=1 \
|
||||||
-DCMAKE_CXX_COMPILER_WORKS=1 \
|
-DCMAKE_CXX_COMPILER_WORKS=1 \
|
||||||
-DCMAKE_C_COMPILER_WORKS=1 \
|
-DCMAKE_C_COMPILER_WORKS=1 \
|
||||||
@@ -63,9 +90,11 @@ ENV CMAKE_ARGS="-DCMAKE_HIP_COMPILER_WORKS=1 \
|
|||||||
-DCMAKE_C_COMPILER=/usr/lib/llvm-21/bin/clang \
|
-DCMAKE_C_COMPILER=/usr/lib/llvm-21/bin/clang \
|
||||||
-DCMAKE_CXX_COMPILER=/usr/lib/llvm-21/bin/clang++ \
|
-DCMAKE_CXX_COMPILER=/usr/lib/llvm-21/bin/clang++ \
|
||||||
-DCMAKE_HIP_COMPILER=/usr/lib/llvm-21/bin/clang++ \
|
-DCMAKE_HIP_COMPILER=/usr/lib/llvm-21/bin/clang++ \
|
||||||
-DUSE_KINETO=OFF \
|
-DPython3_ROOT_DIR=/usr/local \
|
||||||
-DUSE_OPENMP=OFF"
|
-DPYTHON_EXECUTABLE=/usr/local/bin/python3.11 \
|
||||||
|
-DPYTHON_LIBRARY=/usr/local/lib/libpython3.11.so \
|
||||||
|
-DPYTHON_INCLUDE_DIR=/usr/local/include/python3.11"
|
||||||
|
# Pull and build pytorch
|
||||||
WORKDIR /build/pytorch
|
WORKDIR /build/pytorch
|
||||||
RUN git clone https://github.com/pytorch/pytorch.git && \
|
RUN git clone https://github.com/pytorch/pytorch.git && \
|
||||||
cd pytorch && \
|
cd pytorch && \
|
||||||
@@ -73,23 +102,23 @@ RUN git clone https://github.com/pytorch/pytorch.git && \
|
|||||||
make triton && \
|
make triton && \
|
||||||
python tools/amd_build/build_amd.py && \
|
python tools/amd_build/build_amd.py && \
|
||||||
pip install -r requirements.txt && \
|
pip install -r requirements.txt && \
|
||||||
export HIPFLAGS="--rocm-device-lib-path=$DEVICE_LIB_PATH" && \
|
mkdir -p /opt/rocm/bin \
|
||||||
export CMAKE_ARGS="-DCMAKE_HIP_FLAGS=--rocm-device-lib-path=$DEVICE_LIB_PATH -DCMAKE_HIP_COMPILER_ROCM_LIB_PATH=$DEVICE_LIB_PATH -DCMAKE_C_COMPILER=/usr/lib/llvm-21/bin/clang -DCMAKE_CXX_COMPILER=/usr/lib/llvm-21/bin/clang++ -DCMAKE_HIP_COMPILER=/usr/lib/llvm-21/bin/clang++" && \
|
ln -s /usr/bin/hipcc /opt/rocm/bin/hipcc \
|
||||||
|
ln -s /usr/lib/llvm-21/bin/clang++ /usr/bin/clang++ \
|
||||||
python3 setup.py build && \
|
python3 setup.py build && \
|
||||||
python3 setup.py install
|
python3 setup.py install
|
||||||
|
|
||||||
|
|
||||||
# Build ComfyUI
|
# Build ComfyUI
|
||||||
FROM pytorch AS comfyui
|
FROM pytorch AS comfyui
|
||||||
|
WORKDIR /app
|
||||||
RUN git clone https://github.com/comfyanonymous/ComfyUI.git .
|
RUN git clone https://github.com/comfyanonymous/ComfyUI.git .
|
||||||
|
|
||||||
# Install non torch dependant requirements
|
|
||||||
RUN pip3 install -r requirements.txt
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
# Setup Manager
|
# Setup Manager
|
||||||
WORKDIR /app/custom_nodes
|
WORKDIR /app/custom_nodes
|
||||||
RUN git clone https://github.com/Comfy-Org/ComfyUI-Manager.git
|
RUN git clone https://github.com/Comfy-Org/ComfyUI-Manager.git
|
||||||
|
# Setup for run
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 8188
|
EXPOSE 8188
|
||||||
|
# Launch
|
||||||
CMD ["python3", "main.py", "--listen", "0.0.0.0"]
|
CMD ["python3", "main.py", "--listen", "0.0.0.0"]
|
||||||
Reference in New Issue
Block a user