Nodiw52992 commited on
Commit
17e7e4a
·
verified ·
1 Parent(s): a8a5eb0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -9
Dockerfile CHANGED
@@ -1,10 +1,9 @@
 
1
  FROM ubuntu:24.04
2
 
3
- # Build argument for your HF token (not persisted at runtime)
4
- ARG HF_TOKEN
5
- ENV HF_TOKEN=${HF_TOKEN}
6
  ENV DEBIAN_FRONTEND=noninteractive
7
 
 
8
  RUN apt-get update && \
9
  apt-get install -y python3 python3-venv python3-pip git wget && \
10
  rm -rf /var/lib/apt/lists/*
@@ -15,22 +14,22 @@ WORKDIR /workspace
15
  RUN git clone https://github.com/comfyanonymous/ComfyUI.git
16
  WORKDIR /workspace/ComfyUI
17
 
18
- # Setup virtual environment
19
  RUN python3 -m venv .venv && \
20
  . .venv/bin/activate && \
21
  pip install --upgrade pip && \
22
  pip install xformers!=0.0.18 && \
23
  pip install -r requirements.txt
24
 
25
- # Authenticate and download model files
26
- RUN mkdir -p models/unet models/vae && \
27
- wget --header="Authorization: Bearer ${HF_TOKEN}" \
 
28
  https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/flux1-schnell.safetensors \
29
  -O models/unet/flux1-schnell.safetensors && \
30
- wget --header="Authorization: Bearer ${HF_TOKEN}" \
31
  https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/ae.safetensors \
32
  -O models/vae/ae.safetensors
33
- # per Hugging Face guidance: use Bearer headers to download gated/private files :contentReference[oaicite:1]{index=1}
34
 
35
  EXPOSE 7860
36
 
 
1
+ # syntax=docker/dockerfile:1.4
2
  FROM ubuntu:24.04
3
 
 
 
 
4
  ENV DEBIAN_FRONTEND=noninteractive
5
 
6
+ # Install essentials
7
  RUN apt-get update && \
8
  apt-get install -y python3 python3-venv python3-pip git wget && \
9
  rm -rf /var/lib/apt/lists/*
 
14
  RUN git clone https://github.com/comfyanonymous/ComfyUI.git
15
  WORKDIR /workspace/ComfyUI
16
 
17
+ # Setup Python venv
18
  RUN python3 -m venv .venv && \
19
  . .venv/bin/activate && \
20
  pip install --upgrade pip && \
21
  pip install xformers!=0.0.18 && \
22
  pip install -r requirements.txt
23
 
24
+ # Download Flux.1 Schnell (UNET + VAE) using secret token
25
+ RUN --mount=type=secret,id=hf_token \
26
+ mkdir -p models/unet models/vae && \
27
+ wget --header="Authorization: Bearer $(cat /run/secrets/hf_token)" \
28
  https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/flux1-schnell.safetensors \
29
  -O models/unet/flux1-schnell.safetensors && \
30
+ wget --header="Authorization: Bearer $(cat /run/secrets/hf_token)" \
31
  https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/ae.safetensors \
32
  -O models/vae/ae.safetensors
 
33
 
34
  EXPOSE 7860
35