From 1c4d71949f72602c9fdd989c85fc378788b89cf5 Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Sat, 3 Dec 2016 21:09:07 -0800 Subject: [PATCH] Replace m4 template by Dockerfile ARGs --- .../docker/{Dockerfile.m4 => Dockerfile} | 17 ++++------ paddle/scripts/docker/Dockerfile.gpu | 32 +++++++++++++++++++ paddle/scripts/docker/generate.sh | 24 -------------- 3 files changed, 38 insertions(+), 35 deletions(-) rename paddle/scripts/docker/{Dockerfile.m4 => Dockerfile} (65%) create mode 100644 paddle/scripts/docker/Dockerfile.gpu delete mode 100755 paddle/scripts/docker/generate.sh diff --git a/paddle/scripts/docker/Dockerfile.m4 b/paddle/scripts/docker/Dockerfile similarity index 65% rename from paddle/scripts/docker/Dockerfile.m4 rename to paddle/scripts/docker/Dockerfile index f2822acdde7..be077dfc000 100644 --- a/paddle/scripts/docker/Dockerfile.m4 +++ b/paddle/scripts/docker/Dockerfile @@ -1,11 +1,6 @@ -FROM PADDLE_BASE_IMAGE -MAINTAINER PaddlePaddle Dev Team +FROM ubuntu:14.04 +MAINTAINER PaddlePaddle Authors -# It is good to run apt-get install with Dockerfile RUN directive, -# because if the following invocation to /root/build.sh fails, `docker -# build` wouldn't have to re-install packages after we fix -# /root/build.sh. For more about Docker build cache, please refer to -# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#/build-cache. RUN apt-get update && \ apt-get install -y cmake libprotobuf-dev protobuf-compiler git \ libgoogle-glog-dev libgflags-dev libatlas-dev libatlas3-base g++ m4 python-pip \ @@ -16,13 +11,13 @@ RUN apt-get update && \ RUN pip install BeautifulSoup docopt PyYAML pillow \ 'sphinx>=1.4.0' sphinx_rtd_theme breathe recommonmark -ENV WITH_GPU=PADDLE_WITH_GPU -ENV WITH_AVX=PADDLE_WITH_AVX +ARG WITH_AVX +ENV WITH_AVX=${WITH_AVX:-ON} +ENV WITH_GPU=OFF RUN mkdir /paddle COPY . /paddle/ -COPY paddle/scripts/docker/build.sh /root/ -RUN /root/build.sh +RUN /paddle/paddle/scripts/docker/build.sh RUN echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> /etc/profile RUN pip install /usr/local/opt/paddle/share/wheels/*.whl diff --git a/paddle/scripts/docker/Dockerfile.gpu b/paddle/scripts/docker/Dockerfile.gpu new file mode 100644 index 00000000000..292b4dc66b8 --- /dev/null +++ b/paddle/scripts/docker/Dockerfile.gpu @@ -0,0 +1,32 @@ +FROM nvidia/cuda:7.5-cudnn5-devel-ubuntu14.04 +MAINTAINER PaddlePaddle Authors + +RUN apt-get update && \ + apt-get install -y cmake libprotobuf-dev protobuf-compiler git \ + libgoogle-glog-dev libgflags-dev libatlas-dev libatlas3-base g++ m4 python-pip \ + python-protobuf python-numpy python-dev swig openssh-server \ + wget unzip python-matplotlib tar xz-utils bzip2 gzip coreutils \ + sed grep graphviz libjpeg-dev zlib1g-dev doxygen && \ + apt-get clean -y +RUN pip install BeautifulSoup docopt PyYAML pillow \ + 'sphinx>=1.4.0' sphinx_rtd_theme breathe recommonmark + +ARG WITH_AVX +ENV WITH_AVX=${WITH_AVX:-ON} +ENV WITH_GPU=ON + +RUN mkdir /paddle +COPY . /paddle/ +RUN /paddle/paddle/scripts/docker/build.sh + +RUN echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> /etc/profile +RUN pip install /usr/local/opt/paddle/share/wheels/*.whl +RUN paddle version # print version after build + +# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service +RUN mkdir /var/run/sshd +RUN echo 'root:root' | chpasswd +RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config +RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config +EXPOSE 22 +CMD ["/usr/sbin/sshd", "-D"] diff --git a/paddle/scripts/docker/generate.sh b/paddle/scripts/docker/generate.sh deleted file mode 100755 index b808a62ec29..00000000000 --- a/paddle/scripts/docker/generate.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -e -cd `dirname $0` - -m4 -DPADDLE_WITH_GPU=OFF \ - -DPADDLE_WITH_AVX=ON \ - -DPADDLE_BASE_IMAGE=ubuntu:14.04 \ - Dockerfile.m4 > Dockerfile.cpu - -m4 -DPADDLE_WITH_GPU=OFF \ - -DPADDLE_WITH_AVX=OFF \ - -DPADDLE_BASE_IMAGE=ubuntu:14.04 \ - Dockerfile.m4 > Dockerfile.cpu-noavx - -m4 -DPADDLE_WITH_GPU=ON \ - -DPADDLE_WITH_AVX=ON \ - -DPADDLE_BASE_IMAGE=nvidia/cuda:7.5-cudnn5-devel-ubuntu14.04 \ - Dockerfile.m4 > Dockerfile.gpu - -m4 -DPADDLE_WITH_GPU=ON \ - -DPADDLE_WITH_AVX=OFF \ - -DPADDLE_BASE_IMAGE=nvidia/cuda:7.5-cudnn5-devel-ubuntu14.04 \ - Dockerfile.m4 > Dockerfile.gpu-noavx -- GitLab