SINGA-276 Create docker images add build script for creating docker images and the README.md file
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/9a0a3fd2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/9a0a3fd2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/9a0a3fd2 Branch: refs/heads/master Commit: 9a0a3fd2b4902091eae34d880f681ed9791cd539 Parents: ab7221e Author: wangwei <[email protected]> Authored: Wed Jan 11 22:58:19 2017 +0800 Committer: wangwei <[email protected]> Committed: Fri Jan 13 13:39:29 2017 +0800 ---------------------------------------------------------------------- tool/docker/README.md | 34 +++++++++++++ tool/docker/build.sh | 51 ++++++++++++++++++++ tool/docker/runtime/Dockerfile | 4 +- tool/docker/runtime/cuda/Dockerfile | 15 ++++++ .../jenkins/docker/ubuntu14.04/devel/Dockerfile | 2 +- .../jenkins/docker/ubuntu16.04/devel/Dockerfile | 4 +- 6 files changed, 106 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9a0a3fd2/tool/docker/README.md ---------------------------------------------------------------------- diff --git a/tool/docker/README.md b/tool/docker/README.md new file mode 100644 index 0000000..132a696 --- /dev/null +++ b/tool/docker/README.md @@ -0,0 +1,34 @@ +# SINGA Docker Images + +## Availabe images + +| Tag | OS version | devel/runtime | Device|CUDA/CUDNN| +|:----|:-----------|:--------------|:------|:---------| +|runtime| Ubuntu16.04|runtime|CPU|-| +|runtime-cuda| Ubuntu16.04|runtime|GPU|CUDA8.0+CUDNN5| +|devel| Ubuntu16.04|devel|CPU|-| +|devel-cuda| Ubuntu16.04|devel|GPU|CUDA8.0+CUDNN5| + +## Usage + + docker pull nusdbsystem/singa:<Tag> + docker run -it nusdbsystem/singa:<Tag> /bin/bash + +* For the *devel* images, the container has a `incubator-singa` folder in the root directory, +which has the latest SINGA code. The code has been compiled into `incubator-singa/build` directory and PySINGA has been installed. +* For the *runtime* images, the container has only installed the PySINGA. + +## Tag naming style + + singa:devel|runtime[-OS][-CUDA|OPENCL][-CUDNN] + +* devel: development images with all dependent libs' header files installed and SINGA's source code; +* runtime: the minimal images which can run SINGA programs. +* OS: ubuntu, ubuntu14.04, centos, centos6 +* CUDA: cuda, cuda8.0, cuda7.0 +* CUDNN: cudnn, cudnn5, cudnn4 +* OPENCL: opencl, opencl1.2 + +By default, if the version is not included in the tag, the latest stable version is used. +The default OS is ubuntu. The version is the latest stable version (e.g., 16.04 for now). +For -cuda version, the **cudnn** is included by default. Their versions are also the latest stable version, i.e., cuda-8.0 and cudnn-5 for now. http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9a0a3fd2/tool/docker/build.sh ---------------------------------------------------------------------- diff --git a/tool/docker/build.sh b/tool/docker/build.sh new file mode 100755 index 0000000..bc3b488 --- /dev/null +++ b/tool/docker/build.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +#/** +# * +# * Licensed to the Apache Software Foundation (ASF) under one +# * or more contributor license agreements. See the NOTICE file +# * distributed with this work for additional information +# * regarding copyright ownership. The ASF licenses this file +# * to you under the Apache License, Version 2.0 (the +# * "License"); you may not use this file except in compliance +# * with the License. You may obtain a copy of the License at +# * +# * http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# */ + +# build all docker images, must be exected under the root directory, i.e., incubator-singa/ +# ./build.sh PUSH would push the images to dockerhub/nusdbsystem and then delete the local image +# (used by Jenkins to avoid dangling images from multiple building) + +echo "build singa:runtime" +docker build tool/docker/runtime/ --force-rm -t nusdbsystem/singa:runtime +if [ $1 = "PUSH" ]; then + docker push nusdbsystem/singa:runtime + docker rmi nusdbsystem/singa:runtime +fi + +echo "build singa:runtime-cuda" +docker build tool/docker/runtime/cuda --force-rm -t nusdbsystem/singa:runtime-cuda +if [ $1 = "PUSH" ]; then + docker push nusdbsystem/singa:runtime-cuda + docker rmi nusdbsystem/singa:runtime-cuda +fi + +echo "build singa:devel" +docker build tool/docker/devel/ --force-rm -t nusdbsystem/singa:devel +if [ $1 = "PUSH" ]; then + docker push nusdbsystem/singa:devel + docker rmi nusdbsystem/singa:devel +fi + +echo "build singa:devel-cuda" +docker build tool/docker/devel/cuda --force-rm -t nusdbsystem/singa:devel-cuda +if [ $1 = "PUSH" ]; then + docker push nusdbsystem/singa:devel-cuda + docker rmi nusdbsystem/singa:devel-cuda +fi http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9a0a3fd2/tool/docker/runtime/Dockerfile ---------------------------------------------------------------------- diff --git a/tool/docker/runtime/Dockerfile b/tool/docker/runtime/Dockerfile index eb6227d..2bdc400 100644 --- a/tool/docker/runtime/Dockerfile +++ b/tool/docker/runtime/Dockerfile @@ -11,5 +11,5 @@ RUN apt-get update \ && pip --no-cache-dir install -U pip setuptools -# install pysinga -RUN pip install --upgrade http://www.comp.nus.edu.sg/~dbsystem/singa/assets/file/whl/latest/ubuntu16.04-cpp/singa-1.0.1-py2-none-any.whl +# install pysinga TODO(wangwei) install debian package +RUN pip install --upgrade http://www.comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux/latest/ubuntu16.04-cpp/singa-1.0.1-py2-none-any.whl http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9a0a3fd2/tool/docker/runtime/cuda/Dockerfile ---------------------------------------------------------------------- diff --git a/tool/docker/runtime/cuda/Dockerfile b/tool/docker/runtime/cuda/Dockerfile new file mode 100644 index 0000000..c2ec929 --- /dev/null +++ b/tool/docker/runtime/cuda/Dockerfile @@ -0,0 +1,15 @@ +# Base unbuntu 16.04, cuda8.0, cudnn5 +FROM nvidia/cuda:8.0-cudnn5-runtime-ubuntu16.04 + +MAINTAINER incubator-singa [email protected] + +# install dependencies +RUN apt-get update \ + && apt-get install -y --no-install-recommends git python python-pip \ + && apt-get clean && apt-get autoremove && apt-get autoclean \ + && rm -rf /var/lib/apt/lists/* \ + && pip --no-cache-dir install -U pip setuptools + + +# install pysinga TODO(wangwei) install debian package +RUN pip install --upgrade http://www.comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux/latest/ubuntu16.04-cuda8.0-cudnn5/singa-1.0.1-py2-none-any.whl http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9a0a3fd2/tool/jenkins/docker/ubuntu14.04/devel/Dockerfile ---------------------------------------------------------------------- diff --git a/tool/jenkins/docker/ubuntu14.04/devel/Dockerfile b/tool/jenkins/docker/ubuntu14.04/devel/Dockerfile index 838be4a..827eb31 100644 --- a/tool/jenkins/docker/ubuntu14.04/devel/Dockerfile +++ b/tool/jenkins/docker/ubuntu14.04/devel/Dockerfile @@ -8,7 +8,7 @@ FROM nvidia/cuda:7.5-cudnn5-devel # install dependencies RUN apt-get update \ - && apt-get install -y --no-install-recommends git build-essential autoconf libtool cmake libpcre3-dev libprotobuf-dev libopenblas-dev protobuf-compiler python-dev python-pip wget openssh-server\ + && apt-get install -y --no-install-recommends git build-essential autoconf libtool cmake libpcre3-dev python-dev python-pip wget openssh-server \ && apt-get clean && apt-get autoremove && apt-get autoclean \ && rm -rf /var/lib/apt/lists/* \ && pip install -U pip wheel numpy setuptools unittest-xml-reporting protobuf http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9a0a3fd2/tool/jenkins/docker/ubuntu16.04/devel/Dockerfile ---------------------------------------------------------------------- diff --git a/tool/jenkins/docker/ubuntu16.04/devel/Dockerfile b/tool/jenkins/docker/ubuntu16.04/devel/Dockerfile index da8836e..3faf0a7 100644 --- a/tool/jenkins/docker/ubuntu16.04/devel/Dockerfile +++ b/tool/jenkins/docker/ubuntu16.04/devel/Dockerfile @@ -9,11 +9,13 @@ MAINTAINER incubator-singa [email protected] # install dependencies RUN apt-get update \ - && apt-get install -y --no-install-recommends git g++ cmake libprotobuf-dev libopenblas-dev protobuf-compiler python-dev python-pip swig wget openssh-server\ + && apt-get install -y --no-install-recommends git g++ cmake python-dev python-pip swig wget openssh-server \ && apt-get clean && apt-get autoremove && apt-get autoclean \ && rm -rf /var/lib/apt/lists/* \ && pip --no-cache-dir install -U pip wheel numpy setuptools unittest-xml-reporting protobuf +# libprotobuf-dev libopenblas-dev protobuf-compiler \ + # set environment ENV CPLUS_INCLUDE_PATH /usr/local/lib/python2.7/dist-packages/numpy/core/include:${CPLUS_INCLUDE_PATH} ENV CMAKE_INCLUDE_PATH /usr/local/cuda/include:${CMAKE_INCLUDE_PATH}
