Spaces:
Paused
Paused
Create Dockerfile
Browse files- Dockerfile +98 -0
Dockerfile
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Ubuntu as a parent image
|
| 2 |
+
FROM ubuntu:latest
|
| 3 |
+
|
| 4 |
+
# Set environment variables to non-interactive (to avoid prompts)
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
+
|
| 7 |
+
# Switch to root user
|
| 8 |
+
USER root
|
| 9 |
+
|
| 10 |
+
# Update package list, install necessary packages, and clean up
|
| 11 |
+
RUN apt-get update && \
|
| 12 |
+
apt-get install -y \
|
| 13 |
+
build-essential \
|
| 14 |
+
git \
|
| 15 |
+
curl \
|
| 16 |
+
wget \
|
| 17 |
+
vim \
|
| 18 |
+
nano \
|
| 19 |
+
unzip \
|
| 20 |
+
zip \
|
| 21 |
+
python3 \
|
| 22 |
+
python3-pip \
|
| 23 |
+
python3-venv \
|
| 24 |
+
ruby \
|
| 25 |
+
nodejs \
|
| 26 |
+
npm \
|
| 27 |
+
clang \
|
| 28 |
+
gdb \
|
| 29 |
+
valgrind \
|
| 30 |
+
docker.io \
|
| 31 |
+
docker-compose \
|
| 32 |
+
cmake \
|
| 33 |
+
autoconf \
|
| 34 |
+
automake \
|
| 35 |
+
libtool \
|
| 36 |
+
pkg-config \
|
| 37 |
+
clang-format \
|
| 38 |
+
lcov \
|
| 39 |
+
gperf \
|
| 40 |
+
libncurses5-dev \
|
| 41 |
+
libncursesw5-dev \
|
| 42 |
+
libreadline-dev \
|
| 43 |
+
libffi-dev \
|
| 44 |
+
libsqlite3-dev \
|
| 45 |
+
libbz2-dev \
|
| 46 |
+
liblzma-dev \
|
| 47 |
+
netcat-openbsd \
|
| 48 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 49 |
+
|
| 50 |
+
# Create working directory
|
| 51 |
+
WORKDIR /ComfyUI
|
| 52 |
+
|
| 53 |
+
# Copy the application files
|
| 54 |
+
COPY . /ComfyUI
|
| 55 |
+
|
| 56 |
+
# Clone the ComfyUI-Manager repository
|
| 57 |
+
RUN git clone https://github.com/ltdrdata/ComfyUI-Manager.git /ComfyUI/custom_nodes
|
| 58 |
+
|
| 59 |
+
# Create necessary directories with appropriate permissions
|
| 60 |
+
RUN mkdir -p /ComfyUI/custom_nodes/ComfyUI-Manager/.cache && \
|
| 61 |
+
mkdir -p /ComfyUI/custom_nodes/ComfyUI-Manager/config && \
|
| 62 |
+
chown -R root:root /ComfyUI && \
|
| 63 |
+
find /ComfyUI -type d -exec chmod 755 {} + && \
|
| 64 |
+
find /ComfyUI -type f -exec chmod 644 {} + && \
|
| 65 |
+
chown -R root:root /ComfyUI/custom_nodes/ComfyUI-Manager/.cache && \
|
| 66 |
+
chown -R root:root /ComfyUI/custom_nodes/ComfyUI-Manager/config
|
| 67 |
+
|
| 68 |
+
# Create a Python virtual environment
|
| 69 |
+
RUN python3 -m venv /venv
|
| 70 |
+
|
| 71 |
+
# Activate the virtual environment and install Python dependencies
|
| 72 |
+
RUN /venv/bin/pip install --upgrade pip && \
|
| 73 |
+
/venv/bin/pip install -r /ComfyUI/requirements.txt && \
|
| 74 |
+
/venv/bin/pip install GitPython
|
| 75 |
+
|
| 76 |
+
# Set environment variable for the Python virtual environment
|
| 77 |
+
ENV PATH="/venv/bin:$PATH"
|
| 78 |
+
|
| 79 |
+
# Expose the necessary port
|
| 80 |
+
EXPOSE 7860
|
| 81 |
+
|
| 82 |
+
# Define the startup script
|
| 83 |
+
RUN echo '#!/bin/bash\n\
|
| 84 |
+
\n\
|
| 85 |
+
# Activate the virtual environment\n\
|
| 86 |
+
source /venv/bin/activate\n\
|
| 87 |
+
\n\
|
| 88 |
+
# Set environment variables to use CPU only\n\
|
| 89 |
+
export CUDA_VISIBLE_DEVICES=""\n\
|
| 90 |
+
\n\
|
| 91 |
+
# Start ComfyUI\n\
|
| 92 |
+
python3 main.py --listen 0.0.0.0 --port 7860\n' > /start.sh
|
| 93 |
+
|
| 94 |
+
# Set permissions for the startup script
|
| 95 |
+
RUN chmod 755 /start.sh
|
| 96 |
+
|
| 97 |
+
# Set the entry point to the startup script
|
| 98 |
+
ENTRYPOINT ["/start.sh"]
|