Update Dockerfile
Browse files- Dockerfile +32 -13
Dockerfile
CHANGED
|
@@ -2,26 +2,45 @@
|
|
| 2 |
FROM ubuntu:24.04
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
|
| 5 |
-
RUN apt-get update && apt-get install -y
|
| 6 |
-
|
|
|
|
| 7 |
|
| 8 |
WORKDIR /workspace
|
| 9 |
RUN git clone https://github.com/comfyanonymous/ComfyUI.git
|
| 10 |
WORKDIR /workspace/ComfyUI
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
|
|
|
| 16 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
EXPOSE 7860
|
| 27 |
|
|
|
|
| 2 |
FROM ubuntu:24.04
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
|
| 5 |
+
RUN apt-get update && apt-get install -y \
|
| 6 |
+
python3 python3-venv python3-pip git wget \
|
| 7 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
WORKDIR /workspace
|
| 10 |
RUN git clone https://github.com/comfyanonymous/ComfyUI.git
|
| 11 |
WORKDIR /workspace/ComfyUI
|
| 12 |
|
| 13 |
+
# Install dependencies including huggingface_hub
|
| 14 |
+
RUN python3 -m venv .venv \
|
| 15 |
+
&& . .venv/bin/activate \
|
| 16 |
+
&& pip install --upgrade pip \
|
| 17 |
+
&& pip install huggingface_hub xformers!=0.0.18 \
|
| 18 |
+
&& pip install -r requirements.txt
|
| 19 |
|
| 20 |
+
# Download model files securely using hf_hub_download
|
| 21 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
| 22 |
+
. .venv/bin/activate && \
|
| 23 |
+
python3 - << 'EOF'
|
| 24 |
+
import os
|
| 25 |
+
from huggingface_hub import hf_hub_download
|
| 26 |
+
hf = open('/run/secrets/HF_TOKEN').read().strip()
|
| 27 |
+
# UNET
|
| 28 |
+
hf_hub_download(
|
| 29 |
+
repo_id="black-forest-labs/FLUX.1-schnell",
|
| 30 |
+
filename="flux1-schnell.safetensors",
|
| 31 |
+
token=hf,
|
| 32 |
+
local_dir="models/unet",
|
| 33 |
+
force_download=True
|
| 34 |
+
)
|
| 35 |
+
# VAE
|
| 36 |
+
hf_hub_download(
|
| 37 |
+
repo_id="black-forest-labs/FLUX.1-schnell",
|
| 38 |
+
filename="ae.safetensors",
|
| 39 |
+
token=hf,
|
| 40 |
+
local_dir="models/vae",
|
| 41 |
+
force_download=True
|
| 42 |
+
)
|
| 43 |
+
EOF
|
| 44 |
|
| 45 |
EXPOSE 7860
|
| 46 |
|