Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +67 -0
Dockerfile
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Stage 1: Base image with common dependencies
|
| 2 |
+
FROM nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04
|
| 3 |
+
|
| 4 |
+
# Prevents prompts from packages asking for user input during installation
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
+
# Prefer binary wheels over source distributions for faster pip installations
|
| 7 |
+
ENV PIP_PREFER_BINARY=1
|
| 8 |
+
# Ensures output from python is printed immediately to the terminal without buffering
|
| 9 |
+
ENV PYTHONUNBUFFERED=1
|
| 10 |
+
|
| 11 |
+
RUN chmod 1777 /tmp
|
| 12 |
+
|
| 13 |
+
# Install Python, git and other necessary tools
|
| 14 |
+
RUN apt-get update && apt-get install -y \
|
| 15 |
+
python3.10 \
|
| 16 |
+
python3-pip \
|
| 17 |
+
git \
|
| 18 |
+
wget
|
| 19 |
+
|
| 20 |
+
# Clean up to reduce image size
|
| 21 |
+
RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
| 22 |
+
|
| 23 |
+
# Install ComfyUI dependencies
|
| 24 |
+
RUN python3 -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
|
| 25 |
+
|
| 26 |
+
# Install runpod
|
| 27 |
+
RUN pip3 install runpod requests huggingface-hub
|
| 28 |
+
|
| 29 |
+
COPY src/comfyui /comfyui
|
| 30 |
+
RUN rm -rdf /comfyui/models && mkdir /comfyui/models/
|
| 31 |
+
COPY models/checkpoints /comfyui/models/
|
| 32 |
+
COPY models/clip /comfyui/models/
|
| 33 |
+
COPY models/clip_vision /comfyui/models/
|
| 34 |
+
COPY models/configs /comfyui/models/
|
| 35 |
+
COPY models/diffusion_models /comfyui/models/
|
| 36 |
+
COPY models/facedetection /comfyui/models/
|
| 37 |
+
COPY models/facerestore_models /comfyui/models/
|
| 38 |
+
COPY models/insightface /comfyui/models/
|
| 39 |
+
COPY models/inspyrenet /comfyui/models/
|
| 40 |
+
COPY models/pulid /comfyui/models/
|
| 41 |
+
COPY models/rembg /comfyui/models/
|
| 42 |
+
COPY models/roop /comfyui/models/
|
| 43 |
+
COPY models/ultralytics /comfyui/models/
|
| 44 |
+
COPY models/upscale_models /comfyui/models/
|
| 45 |
+
COPY models/vae /comfyui/models/
|
| 46 |
+
|
| 47 |
+
RUN pip3 install --upgrade -r /comfyui/requirements.txt
|
| 48 |
+
|
| 49 |
+
RUN find /comfyui/custom_nodes -name 'requirements.txt' -exec bash -c 'pip install -r <(grep -v -E "^torch|^torchsde|^torchvision|^transformers|^safetensors|^cuml-cu11|^xformers|^pytorch_lightning" {})' \;
|
| 50 |
+
RUN cd /comfyui && find ./custom_nodes -type f -name 'install.py' -exec python3 {} \;
|
| 51 |
+
|
| 52 |
+
COPY src/patch /tmp/patch
|
| 53 |
+
RUN cp /tmp/patch/face_analysis.py $(python3 -c "import site; print(site.getsitepackages()[0])")/insightface/app/face_analysis.py
|
| 54 |
+
|
| 55 |
+
# 卡通人脸检测
|
| 56 |
+
RUN huggingface-cli download "deepghs/anime_face_detection" face_detect_v1.4_s/model.onnx
|
| 57 |
+
|
| 58 |
+
# Support for the network volume
|
| 59 |
+
ADD src/extra_model_paths.yaml /comfyui/
|
| 60 |
+
WORKDIR /
|
| 61 |
+
|
| 62 |
+
# Add the start and the handler
|
| 63 |
+
ADD src/start.sh src/rp_handler.py test_input.json /
|
| 64 |
+
RUN chmod +x /start.sh
|
| 65 |
+
|
| 66 |
+
# Start the container
|
| 67 |
+
CMD /start.sh
|