Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devcontainer creation #13

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .devcontainer/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EXAMPLE1=Testing123
32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "diffusion-confusion",
"build": {
"dockerfile": "../Dockerfile",
"context": ".."
},
"containerUser": "1000",
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
},
"extensions": [
"ms-python.python"
],
"mounts": [
"source=cache,target=/home/dev/.cache,type=volume"
],
"workspaceFolder": "/code",
"workspaceMount": "source=${localWorkspaceFolder},target=/code,type=bind,consistency=cached",
"runArgs": [
"--ipc=host",
"--env-file=.devcontainer/.env",
"--gpus",
"all"
],
"postCreateCommand": "jq --arg GITHUB_PAT $GITHUB_PAT '.gist_it_personal_access_token = $GITHUB_PAT' ~/.jupyter/nbconfig/notebook.json > ~/.jupyter/nbconfig/notebook1.json && cp ~/.jupyter/nbconfig/notebook1.json ~/.jupyter/nbconfig/notebook.json && jupyter notebook --no-browser --NotebookApp.token='' --NotebookApp.password=''"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sd-concept-output/
.ipynb_checkpoints/
.env
50 changes: 50 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM nvidia/cuda:11.3.1-cudnn8-runtime-ubuntu20.04

ARG USERNAME=dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN apt-key adv --fetch-keys https://developer.download.nvidia.cn/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub

ENV PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cu116
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8
RUN apt update -y && apt install -y sudo
RUN groupadd --gid $USER_GID $USERNAME &&\
useradd --uid $USER_UID --gid $USER_GID -m $USERNAME &&\
echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} &&\
chmod 0440 /etc/sudoers.d/${USERNAME}

RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=~/.bash_history" && echo $SNIPPET >> "/home/${USERNAME}/.bashrc"

RUN apt update -y
RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata
RUN apt install -y \
build-essential \
curl \
git

# GPU Setup
RUN apt-get install -y \
libcairo2-dev \
libgl1-mesa-glx \
software-properties-common

# Install Python 3.9
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt install -y python3.9-dev python3.9-venv
RUN python3.9 -m ensurepip
RUN ln -s /usr/bin/python3.9 /usr/local/bin/python
RUN ln -s /usr/local/bin/pip3.9 /usr/local/bin/pip
RUN pip install --upgrade pip

USER ${USERNAME}

CMD mkdir -p /code
WORKDIR /code
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN git config --global credential.helper store
RUN /home/dev/.local/bin/jupyter contrib nbextension install --user
RUN sudo apt install jq -y
RUN /home/dev/.local/bin/jupyter nbextension enable gist_it/main
ADD . .
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ fastai
diffusers
transformers
huggingface-hub
notebook<6
jupyter_contrib_nbextensions
nbconvert<6.2
jinja2<3.1
ipywidgets
opencv-python