File size: 1,892 Bytes
c204b72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04

# 必要なパッケージをインストール
RUN apt-get update && apt-get install -y \
    git wget python3 python3-pip && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# Pythonのデフォルト実行ファイルをpython3に変更
RUN ln -s /usr/bin/python3 /usr/bin/python

# Hugging Face APIトークンを環境変数として設定
ARG HF_TOKEN
ENV HF_TOKEN=${HF_TOKEN}

# リポジトリをクローン
WORKDIR /
RUN git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git

# 必要なモデルをダウンロード
WORKDIR /stable-diffusion-webui-forge/models/text_encoder
RUN wget --header="Authorization: Bearer ${HF_TOKEN}" \
    https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.safetensors \
    https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/text_encoder/model.fp16.safetensors \
    https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/text_encoder/model.safetensors \
    https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors

RUN mkdir -p /stable-diffusion-webui-forge/models/clip/
WORKDIR /stable-diffusion-webui-forge/models/clip/
RUN wget --header="Authorization: Bearer ${HF_TOKEN}" \
    "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors" \
    "https://huggingface.co/openai/clip-vit-large-patch14/resolve/main/model.safetensors"

WORKDIR /stable-diffusion-webui-forge/models/Stable-diffusion
RUN wget --header="Authorization: Bearer ${HF_TOKEN}" \
    https://huggingface.co/stabilityai/stable-diffusion-3.5-large/resolve/main/sd3.5_large.safetensors \
    https://huggingface.co/lllyasviel/flux1-dev-bnb-nf4/resolve/main/flux1-dev-bnb-nf4-v2.safetensors

# WebUIの起動
WORKDIR /stable-diffusion-webui-forge
CMD ["python3", "launch.py", "--share"]