Skip to content

Instantly share code, notes, and snippets.

@brianjking
Last active February 12, 2023 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianjking/0146bbc5b9eecd0931e8b58775c6de5b to your computer and use it in GitHub Desktop.
Save brianjking/0146bbc5b9eecd0931e8b58775c6de5b to your computer and use it in GitHub Desktop.
# Dockerfile Private A10G
# Modified from https://huggingface.co/spaces/camenduru/webui-docker/blob/main/Dockerfile.Private.A10G
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/11.7.1/ubuntu2204/devel/cudnn8/Dockerfile
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04
ENV DEBIAN_FRONTEND noninteractive
WORKDIR /content
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y libgl1 libglib2.0-0 wget git git-lfs python3-pip python-is-python3 && pip3 install --upgrade pip
RUN pip install https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.16/xformers-0.0.16+814314d.d20230119.A10G-cp310-cp310-linux_x86_64.whl
RUN pip install --pre triton
RUN pip install numexpr
RUN git clone -b v1.6 https://github.com/camenduru/stable-diffusion-webui
RUN sed -i '$a fastapi==0.90.0' /content/stable-diffusion-webui/requirements_versions.txt
RUN sed -i -e '''/prepare_environment()/a\ os.system\(f\"""sed -i -e ''\"s/dict()))/dict())).cuda()/g\"'' /content/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py""")''' /content/stable-diffusion-webui/launch.py
RUN sed -i -e 's/ start()/ #start()/g' /content/stable-diffusion-webui/launch.py
RUN cd stable-diffusion-webui && python launch.py --skip-torch-cuda-test
ADD https://raw.githubusercontent.com/camenduru/stable-diffusion-webui-scripts/main/run_n_times.py /content/stable-diffusion-webui/scripts/run_n_times.py
RUN git clone https://github.com/camenduru/deforum-for-automatic1111-webui /content/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui
RUN git clone https://github.com/yfszzx/stable-diffusion-webui-images-browser /content/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser
RUN git clone https://github.com/camenduru/stable-diffusion-webui-huggingface /content/stable-diffusion-webui/extensions/stable-diffusion-webui-huggingface
RUN git clone https://github.com/camenduru/sd-webui-additional-networks /content/stable-diffusion-webui/extensions/sd-webui-additional-networks
RUN git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui-nsfw-censor /content/stable-diffusion-webui/extensions/stable-diffusion-webui-nsfw-censor
RUN git clone https://github.com/Coyote-A/ultimate-upscale-for-automatic1111 /content/stable-diffusion-webui/extensions/ultimate-upscale-for-automatic1111
COPY config.json /content/config.json
COPY ui-config.json /content/ui-config.json
# models
ADD https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned.ckpt /content/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned.ckpt
ADD https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-ema-pruned.ckpt /content/stable-diffusion-webui/models/Stable-diffusion/v2-1_768-ema-pruned.ckpt
ADD https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml /content/stable-diffusion-webui/models/Stable-diffusion/v2-1_768-ema-pruned.yaml
ADD https://huggingface.co/prompthero/openjourney-v2/resolve/main/openjourney-v2.ckpt /content/stable-diffusion-webui/models/Stable-diffusion/openjourney-v2.ckpt
# ADD https://huggingface.co/andite/anything-v4.0/resolve/main/anything-v4.5-pruned.ckpt /content/stable-diffusion-webui/models/Stable-diffusion/anything-v4.5-pruned.ckpt
# ADD https://huggingface.co/andite/anything-v4.0/resolve/main/anything-v4.0.vae.pt /content/stable-diffusion-webui/models/Stable-diffusion/anything-v4.5-pruned.vae.pt
RUN adduser --disabled-password --gecos '' user
RUN chown -R user:user /content
RUN chmod -R 777 /content
USER user
EXPOSE 7860
CMD cd /content/stable-diffusion-webui && python webui.py --xformers --listen --disable-console-progressbars --ui-config-file /content/ui-config.json --ui-settings-file /content/config.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment