Browse Source

Merge pull request #101 from jqueguiner/jqueguiner-add-docker-support

[Docker] add docker support
Jason Antic 6 years ago
parent
commit
d637bb4a0d
4 changed files with 67 additions and 0 deletions
  1. 40 0
      Dockerfile
  2. 22 0
      README.md
  3. 1 0
      run_notebook.sh
  4. 4 0
      set_password.py

+ 40 - 0
Dockerfile

@@ -0,0 +1,40 @@
+From nvcr.io/nvidia/pytorch:19.04-py3
+
+RUN apt-get -y update
+
+RUN apt-get install -y python3-pip software-properties-common wget
+
+RUN add-apt-repository ppa:git-core/ppa
+
+RUN apt-get -y update
+
+RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
+
+RUN apt-get install -y git-lfs --allow-unauthenticated
+
+RUN git lfs install
+
+ENV GIT_WORK_TREE=/data
+
+RUN mkdir -p /root/.torch/models
+
+RUN mkdir -p /data/models
+
+RUN wget -O /root/.torch/models/vgg16_bn-6c64b313.pth https://download.pytorch.org/models/vgg16_bn-6c64b313.pth
+
+RUN wget -O /root/.torch/models/resnet34-333f7ec4.pth https://download.pytorch.org/models/resnet34-333f7ec4.pth
+
+RUN wget -O /data/models/ColorizeArtistic_gen.pth https://www.dropbox.com/s/zkehq1uwahhbc2o/ColorizeArtistic_gen.pth?dl=0 
+
+ADD . /data/
+
+WORKDIR /data
+
+RUN pip install -r requirements.txt
+
+RUN cd /data/test_images && git lfs pull
+
+EXPOSE 8888
+
+ENTRYPOINT ["sh", "/data/run_notebook.sh"]
+

+ 22 - 0
README.md

@@ -215,6 +215,28 @@ jupyter lab
 
 From there you can start running the notebooks in Jupyter Lab, via the url they provide you in the console.  
 
+#### Docker
+
+You can build and run the docker using the foloowing process:
+
+Cloning
+```console
+git clone https://github.com/jantic/DeOldify.git DeOldify
+```
+
+Building Docker
+```console
+cd DeOldify && docker build -t deoldify .
+```
+
+Running Docker
+```console
+echo "http://$(curl ifconfig.io):8888" && nvidia-docker run --ipc=host --env NOTEBOOK_PASSWORD="pass123" -p 8888:8888 -it deoldify
+```
+
+If you don't have Nvidia Docker here the installation guide :
+https://github.com/nvidia/nvidia-docker/wiki/Installation-(version-2.0)#installing-version-20
+
 #### Note 
 Make sure you have Git LFS installed if you're planning on using images in the /test_images/ folder.  Otherwise, you'll just wind up getting tiny files that will have the same file names but you will run into errors trying to open them or colorize them.  If you have a fancy shmancy git client like GitHub Desktop, it will probably prompt you to install it and do it for you.  If that doesn't happen,  get it here: https://git-lfs.github.com/
 

+ 1 - 0
run_notebook.sh

@@ -0,0 +1 @@
+jupyter notebook --port=8888 --no-browser --allow-root --ip=0.0.0.0 --NotebookApp.token="" --NotebookApp.password="$(python set_password.py $NOTEBOOK_PASSWORD)"

+ 4 - 0
set_password.py

@@ -0,0 +1,4 @@
+import sys
+from IPython.lib import passwd
+password = passwd(sys.argv[1])
+print(password)