Nodiw52992 commited on
Commit
c3b9cdb
·
verified ·
1 Parent(s): a91a3df

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -23
Dockerfile CHANGED
@@ -10,37 +10,19 @@ 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
 
 
10
  RUN git clone https://github.com/comfyanonymous/ComfyUI.git
11
  WORKDIR /workspace/ComfyUI
12
 
 
13
  RUN python3 -m venv .venv \
14
  && . .venv/bin/activate \
15
  && pip install --upgrade pip \
16
  && pip install huggingface_hub xformers!=0.0.18 \
17
  && pip install -r requirements.txt
18
 
19
+ # Copy download script
20
+ COPY download_flux.py /workspace/ComfyUI/download_flux.py
21
+
22
+ # Use secret to download model files via huggingface_hub
23
  RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
24
  . .venv/bin/activate && \
25
+ python download_flux.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  EXPOSE 7860
28