-
-
Save KaiLicht/6754e4d1cc454690208f7af5f6416a19 to your computer and use it in GitHub Desktop.
dev_env_I_medium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Install docker via get.docker script | |
curl -fsSL get.docker.com -o get-docker.sh | |
sh get-docker.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Add the package repositories for nvidia docker | |
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \ | |
apt-key add - | |
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu16.04/amd64/nvidia-docker.list | tee /etc/apt/sources.list.d/nvidia-docker.list | |
apt-get update | |
#Install nvidia-docker2 and reload the Docker daemon configuration | |
apt-get install -y nvidia-docker2 pkill -SIGHUP dockerd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Test nvidia-smi with the latest official CUDA image | |
docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker pull nvcr.io/nvidia/tensorflow:18.04-py3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nvcr.io/nvidia/tensorflow:18.04-py3 | |
LABEL maintainer="Kai Lichtenberg <kai@sentin.ai>" | |
#Arguments | |
ARG USER="docker" | |
ARG myUID="1000" | |
ARG myGID="1000" | |
#Specifiy R and Keras Version | |
ENV R_BASE_VERSION=3.4.4 | |
ENV KERAS_VERSION=2.1.5 | |
#Set a user | |
RUN groupadd --gid "${myGID}" "${USER}" \ | |
&& useradd \ | |
--uid ${myUID} \ | |
--gid ${myGID} \ | |
--create-home \ | |
--shell /bin/bash \ | |
${USER} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Install packages needed | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends \ | |
ed \ | |
locales \ | |
vim-tiny \ | |
fonts-texgyre \ | |
gnupg2 \ | |
libcurl4-openssl-dev \ | |
libssl-dev \ | |
libssh2-1-dev \ | |
sudo \ | |
virtualenv \ | |
&& rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Add mirror | |
RUN echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" >> /etc/apt/sources.list \ | |
&& gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9 \ | |
&& gpg -a --export E084DAB9 | apt-key add - | |
# Install R-base (rocker/r-base with little modification) | |
# Now install R and littler, and create a link for littler in /usr/local/bin | |
# Also set a default CRAN repo, and make sure littler knows about it too | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends \ | |
littler \ | |
r-cran-littler \ | |
r-base=${R_BASE_VERSION}-* \ | |
r-base-dev=${R_BASE_VERSION}-* \ | |
r-recommended=${R_BASE_VERSION}-* \ | |
&& echo 'options(repos = c(CRAN = "https://cran.rstudio.com/"), download.file.method = "libcurl")' >> /etc/R/Rprofile.site \ | |
&& echo 'source("/etc/R/Rprofile.site")' >> /etc/littler.r \ | |
&& ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r \ | |
&& ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r \ | |
&& ln -s /usr/share/doc/littler/examples/installGithub.r /usr/local/bin/installGithub.r \ | |
&& ln -s /usr/share/doc/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \ | |
&& install.r docopt \ | |
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \ | |
&& rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Install tensorflow and keras | |
ENV WORKON_HOME=/home/${USER}/.virtualenvs | |
RUN install2.r devtools remotes \ | |
&& installGithub.r rstudio/tensorflow \ | |
&& installGithub.r rstudio/keras \ | |
&& virtualenv --system-site-packages /home/${USER}/.virtualenvs/r-tensorflow --python=python3.5 \ | |
&& /bin/bash -c "cd /home/${USER}/.virtualenvs/r-tensorflow/bin/; \ | |
source activate; \ | |
pip3 --no-cache-dir install git+git://github.com/fchollet/keras.git@${KERAS_VERSION}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment