test-docker / Dockerfile
MRamzan's picture
Create Dockerfile
afc15bc verified
# 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