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.

Revisions

  1. masterdezign revised this gist Jun 5, 2024. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -45,15 +45,13 @@ 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

    RUN pip3 install kmeans-pytorch scikit-learn
    RUN pip3 install pytorch-lightning==1.9.1

    # Diffusion-related
    RUN pip3 install --upgrade diffusers[torch]

  2. masterdezign created this gist Jun 5, 2024.
    71 changes: 71 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,71 @@
    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

    USER "root"
    RUN echo "conda activate base" >> "/root/.zshrc"
    RUN zsh -c "conda install -y pytables"
    USER $UID

    RUN pip3 install kmeans-pytorch scikit-learn
    RUN pip3 install pytorch-lightning==1.9.1

    # 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"