Skip to content

Commit

Permalink
Support for Automatically Creating Docker Images
Browse files Browse the repository at this point in the history
Add docker related files, to be tested via webhooks. Closes #61.

from toksaitov/neural-doodle-gpu

* Rename gpu based Dockerfile

* Update gpu based dockerfile.

* Add dockerfile for cpu.

* Docker:install requirements before copying project

to better use cache

* Docker: remove apt lists after install.

* Move .theanorc to project root.

* No need for --ignore-installed

removing

* use openjpeg2 provided by ubuntu

* fix samples copy location.
  • Loading branch information
jiahuif authored and alexjc committed May 3, 2016
1 parent fff8c44 commit c5e91cf
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .theanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[global]
device=gpu
floatX=float32

[nvcc]
fastmath=True
50 changes: 50 additions & 0 deletions docker-cpu.df
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM ubuntu:14.04

# Install dependencies

RUN apt-get update && \
apt-get install --assume-yes \
"build-essential" \
"cmake" \
"git" \
"wget" \
"libopenjpeg2" \
"libopenblas-dev" \
"liblapack-dev" \
"libjpeg-dev" \
"libtiff5-dev" \
"zlib1g-dev" \
"libfreetype6-dev" \
"liblcms2-dev" \
"libwebp-dev" \
"tcl8.6-dev" \
"tk8.6-dev" \
"gfortran" \
"python3" \
"python3-dev" \
"python3-pip" \
"python3-numpy" \
"python3-scipy" \
"python3-matplotlib" \
"python3-six" \
"python3-networkx" \
"python3-tk" && \
rm -rf /var/lib/apt/lists/* && \
python3 -m pip install "cython"

# Install requirements before copying project files
WORKDIR /neural-doodle
COPY requirements.txt .
RUN python3 -m pip install -r "requirements.txt"

# Copy only required project files
COPY samples samples
COPY doodle.py .

# Get a pre-trained neural network (VGG19)

RUN wget "https://github.com/alexjc/neural-doodle/releases/download/v0.0/vgg19_conv.pkl.bz2"

# Set an entrypoint to the main doodle.py script

ENTRYPOINT ["python3", "doodle.py"]
55 changes: 55 additions & 0 deletions docker-gpu.df
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM nvidia/cuda:7.5-cudnn4-devel

# Install dependencies

RUN apt-get update && \
apt-get install --assume-yes \
"module-init-tools" \
"build-essential" \
"cmake" \
"git" \
"wget" \
"libopenjpeg2" \
"libopenblas-dev" \
"liblapack-dev" \
"libjpeg-dev" \
"libtiff5-dev" \
"zlib1g-dev" \
"libfreetype6-dev" \
"liblcms2-dev" \
"libwebp-dev" \
"tcl8.6-dev" \
"tk8.6-dev" \
"gfortran" \
"python3" \
"python3-dev" \
"python3-pip" \
"python3-numpy" \
"python3-scipy" \
"python3-matplotlib" \
"python3-six" \
"python3-networkx" \
"python3-tk" && \
rm -rf /var/lib/apt/lists/* && \
python3 -m pip install "cython"

# Install requirements before copying project files
WORKDIR /neural-doodle
COPY requirements.txt .
RUN python3 -m pip install -r "requirements.txt"

# Copy only required project files
COPY samples samples
COPY doodle.py .

# Copy Theano's configuration

COPY .theanorc /root/

# Get a pre-trained neural network (VGG19)

RUN wget "https://github.com/alexjc/neural-doodle/releases/download/v0.0/vgg19_conv.pkl.bz2"

# Set an entrypoint to the main doodle.py script

ENTRYPOINT ["python3", "doodle.py", "--device=gpu"]
23 changes: 23 additions & 0 deletions docker/install-cuda-drivers-ubuntu-14.04.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# Install dependencies

apt-get update
apt-get install --assume-yes \
"linux-source" \
"linux-headers-$(uname --kernel-release)" \
"linux-image-extra-$(uname --kernel-release)" \
"build-essential" \
"wget"

# Install NVIDIA CUDA with NVIDIA GPU drivers

CUDA_REPOSITORY="cuda-repo-ubuntu1404_7.5-18_amd64.deb"
CUDA_REPOSITORY_URL="http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64"

wget --directory-prefix="/tmp/" --continue "$CUDA_REPOSITORY_URL/$CUDA_REPOSITORY"
dpkg --install "/tmp/$CUDA_REPOSITORY"
apt-get update
apt-get install "cuda"

rm --interactive "/tmp/$CUDA_REPOSITORY"
22 changes: 22 additions & 0 deletions docker/install-nvidia-docker-ubuntu-14.04.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Install dependencies

apt-get update
apt-get install --assume-yes "wget"

# Install Docker Engine

wget --quiet --output-document="-" "https://get.docker.com" | sh
usermod --append --groups="docker" "$SUDO_USER"

# Install an NVIDIA Docker wrapper

NVIDIA_DOCKER="nvidia-docker_1.0.0.beta.2-1_amd64.deb"
NVIDIA_DOCKER_URL="https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.0-beta.2"

wget --directory-prefix="/tmp/" --continue "$NVIDIA_DOCKER_URL/$NVIDIA_DOCKER"
dpkg --install "/tmp/$NVIDIA_DOCKER"
rm --interactive "/tmp/$NVIDIA_DOCKER"

nvidia-docker volume setup

0 comments on commit c5e91cf

Please sign in to comment.