forge-ui / Dockerfile
tomboyman's picture
Update Dockerfile
4ac740b 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 required system packages
RUN apt-get update && \
apt-get install -y \
git \
wget \
libgl1-mesa-glx \
libglvnd0 \
libglib2.0-0 \
libsm6 \
libxrender1 \
libxext6 \
xvfb \
build-essential \
cmake \
libgoogle-perftools-dev \
&& 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
# Install xformers and tcmalloc
RUN pip install xformers
RUN pip install gdown
# Clone the repository
RUN git clone https://github.com/lllyasviel/stable-diffusion-webui-forge
# Set the working directory
WORKDIR $HOME/stable-diffusion-webui-forge/
# Clone extensions into the correct directory
RUN git clone https://github.com/AlUlkesh/stable-diffusion-webui-images-browser.git extensions/stable-diffusion-webui-images-browser
RUN git clone https://github.com/camenduru/stable-diffusion-webui-huggingface.git extensions/stable-diffusion-webui-huggingface
RUN git clone https://github.com/BlafKing/sd-civitai-browser-plus.git extensions/civitai-browser
RUN git clone https://github.com/zanllp/sd-webui-infinite-image-browsing.git extensions/sd-webui-infinite-image-browsing
# Create directories
RUN mkdir -p models/Lora \
models/Stable-diffusion \
models/ControlNet
WORKDIR $HOME/stable-diffusion-webui-forge
EXPOSE 7860
# Run the command
CMD bash webui.sh -f --port 7860 --listen --cuda-malloc --cuda-stream --pin-shared-memory --enable-insecure-extension-access