Skip to content

Instantly share code, notes, and snippets.

@masterdezign
Created June 5, 2024 13:35
Show Gist options
  • Save masterdezign/1a5ff6ff9b2fd028a6c48d9e968abe23 to your computer and use it in GitHub Desktop.
Save masterdezign/1a5ff6ff9b2fd028a6c48d9e968abe23 to your computer and use it in GitHub Desktop.
Dockerfile for diffusers
FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-runtime
ARG USER="user"
ARG UID="1000"
ARG GID="100"
USER "root"
RUN apt-get update && apt-get install -y gnupg
# tzdata is required below. To avoid hanging, install it first.
RUN DEBIAN_FRONTEND="noninteractive" apt-get install tzdata -y
RUN apt-get update && apt-get -yqq install ssh git vim ctags zsh curl \
python-opengl ffmpeg xvfb build-essential rar unzip \
libglib2.0-0 wget libgl1-mesa-glx \
swig4.0 python3-opencv
# Alias
RUN ln -s /usr/bin/swig4.0 /usr/bin/swig
RUN pip3 install --upgrade pip
# Create user
RUN useradd -l -m -s /bin/zsh -N -u "${UID}" "${USER}"
# Switch to the created user
USER $UID
# Install Oh-My-Zsh
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Set a custom theme to distinguish the shell.
# See also https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
RUN sed -i 's/robbyrussell/apple/g' $HOME/.zshrc
RUN conda init zsh
RUN echo "conda activate base" >> "/home/${USER}/.zshrc"
RUN pip3 install jupyter
RUN pip3 install pyvirtualdisplay
RUN pip3 install matplotlib
RUN pip3 install tensorboard
RUN pip3 install opencv-python-headless
# https://stackoverflow.com/questions/73929564/entrypoints-object-has-no-attribute-get-digital-ocean
RUN pip3 install importlib-metadata==4.13.0
RUN pip3 install Pillow
RUN pip3 install scikit-learn
USER "root"
RUN echo "conda activate base" >> "/root/.zshrc"
RUN zsh -c "conda install -y pytables"
USER $UID
# Diffusion-related
RUN pip3 install --upgrade diffusers[torch]
USER "root"
RUN apt -qq install git-lfs
USER $UID
RUN git config --global credential.helper store
RUN pip3 install datasets
RUN pip3 install transformers
WORKDIR /workspace/
CMD "ls"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment