File size: 1,783 Bytes
afc15bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Use an appropriate base image
FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime

ENV TZ=Europe/Minsk
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Install git, libgl1-mesa-glx, libglvnd0, and xvfb
RUN apt-get update && \
    apt-get install -y \
    git \
    wget \
    libgl1-mesa-glx \
    libglvnd0 \
    libglib2.0-0 \
    libsm6 \
    libxrender1 \
    libxext6 \
    xvfb \
    && apt-get clean

# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user

# Switch to the "user" user
USER user

# Set home to the user's home directory
ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH

# Set the working directory to the user's home directory
WORKDIR $HOME

# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
RUN pip install --no-cache-dir --upgrade pip

# Clone the repository
RUN git clone https://github.com/lllyasviel/stable-diffusion-webui-forge

# Set the working directory
WORKDIR $HOME/stable-diffusion-webui-forge/

# RUN bash webui.sh -f --skip-torch-cuda-test

RUN pip install gdown

# Create directories
RUN mkdir -p models/Lora \
             models/Stable-diffusion \
             models/ControlNet

# Download files and weights
WORKDIR $HOME/stable-diffusion-webui-forge/models/Lora
RUN wget -q --content-disposition "https://civitai.com/api/download/models/283697?type=Model&format=SafeTensor" && \
    gdown 1Y4ROZ7DfKcRaHVbmw0re1HcbTjcvCiAd && \
    gdown 1kHDRCvx_yMkz4vOsy-XQAp9kjtFjEbWe
    
WORKDIR $HOME/stable-diffusion-webui-forge

RUN ls -l models/Lora

# COPY download_files.sh .
# RUN bash download_files.sh

EXPOSE 7860

# Run the command
CMD bash webui.sh -f --port 7860 --listen --cuda-malloc --cuda-stream --pin-shared-memory