1+ # A image for building paddle binaries
2+ # Use cuda devel base image for both cpu and gpu environment
3+
4+ # When you modify it, please be aware of cudnn-runtime version
5+ # and libcudnn.so.x in paddle/scripts/docker/build.sh
6+ # Because we use cuda9, otherwise bounch of this can be replaced with
7+ # paddlepaddle/paddle:latest-dev
8+ FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
9+ MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
10+
11+ ARG UBUNTU_MIRROR
12+ RUN /bin/bash -c 'if [[ -n ${UBUNTU_MIRROR} ]]; then sed -i ' s#http://archive.ubuntu.com/ubuntu#${UBUNTU_MIRROR}#g' /etc/apt/sources.list; fi'
13+
14+ # ENV variables
15+ ARG WITH_GPU
16+ ARG WITH_AVX
17+ ARG WITH_DOC
18+
19+ ENV WOBOQ OFF
20+ ENV WITH_GPU=${WITH_GPU:-ON}
21+ ENV WITH_AVX=${WITH_AVX:-ON}
22+ ENV WITH_DOC=${WITH_DOC:-OFF}
23+
24+ ENV HOME /root
25+ # Add bash enhancements
26+ COPY ./paddle/scripts/docker/root/ /root/
27+
28+ RUN apt-get update && \
29+ apt-get install -y --allow-downgrades \
30+ git python-pip python-dev openssh-server bison \
31+ libnccl2 libnccl-dev \
32+ wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \
33+ curl sed grep graphviz libjpeg-dev zlib1g-dev \
34+ python-matplotlib gcc-4.8 g++-4.8 \
35+ automake locales clang-format swig doxygen cmake \
36+ liblapack-dev liblapacke-dev \
37+ clang-3.8 llvm-3.8 libclang-3.8-dev \
38+ net-tools libtool && \
39+ apt-get clean -y
40+
41+ # Install Go and glide
42+ RUN wget -qO- https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz | \
43+ tar -xz -C /usr/local && \
44+ mkdir /root/gopath && \
45+ mkdir /root/gopath/bin && \
46+ mkdir /root/gopath/src
47+ ENV GOROOT=/usr/local/go GOPATH=/root/gopath
48+ # should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT.
49+ ENV PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin
50+ # install glide
51+ RUN curl -s -q https://glide.sh/get | sh
52+
53+ # Install TensorRT
54+ # following TensorRT.tar.gz is not the default official one, we do two miny changes:
55+ # 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now,
56+ # and its size is only one-third of the official one.
57+ # 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle.
58+ # See https://github.com/PaddlePaddle/Paddle/issues/10129 for details.
59+ RUN wget -qO- http://paddlepaddledeps.bj.bcebos.com/TensorRT-4.0.0.3.Ubuntu-16.04.4.x86_64-gnu.cuda-8.0.cudnn7.0.tar.gz | \
60+ tar -xz -C /usr/local && \
61+ cp -rf /usr/local/TensorRT/include /usr && \
62+ cp -rf /usr/local/TensorRT/lib /usr
63+
64+ # git credential to skip password typing
65+ RUN git config --global credential.helper store
66+
67+ # Fix locales to en_US.UTF-8
68+ RUN localedef -i en_US -f UTF-8 en_US.UTF-8
69+
70+ # FIXME: due to temporary ipykernel dependency issue, specify ipykernel jupyter
71+ # version util jupyter fixes this issue.
72+
73+ # specify sphinx version as 1.5.6 and remove -U option for [pip install -U
74+ # sphinx-rtd-theme] since -U option will cause sphinx being updated to newest
75+ # version(1.7.1 for now), which causes building documentation failed.
76+ RUN pip install --upgrade pip==9.0.3 && \
77+ pip install -U wheel && \
78+ pip install -U docopt PyYAML sphinx==1.5.6 && \
79+ pip install sphinx-rtd-theme==0.1.9 recommonmark
80+
81+ RUN pip install pre-commit 'ipython==5.3.0' && \
82+ pip install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
83+ pip install opencv-python
84+
85+ COPY ./python/requirements.txt /root/
86+ RUN pip install -r /root/requirements.txt
87+
88+ # To fix https://github.com/PaddlePaddle/Paddle/issues/1954, we use
89+ # the solution in https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
90+ RUN apt-get install -y libssl-dev libffi-dev
91+ RUN pip install certifi urllib3[secure]
92+
93+
94+ # Install woboq_codebrowser to /woboq
95+ RUN git clone https://github.com/woboq/woboq_codebrowser /woboq && \
96+ (cd /woboq \
97+ cmake -DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-3.8 \
98+ -DCMAKE_BUILD_TYPE=Release . \
99+ make)
100+
101+
102+ # Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
103+ RUN mkdir /var/run/sshd
104+ RUN echo 'root:root' | chpasswd
105+ RUN sed -ri 's/^PermitRootLogin\s +.*/PermitRootLogin yes/' /etc/ssh/sshd_config
106+ RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
107+ EXPOSE 22
108+
109+ # build the app and host it
110+ RUN apt-get update && apt-get install -y python3 python3-pip mongodb openjdk-8-jdk ccache
111+ RUN pip3 install flask flask-cache pymongo xonsh numpy
112+
113+ RUN apt-get update && apt install -y uwsgi nginx supervisor software-properties-common python-software-properties
114+
115+ ENV NGINX_MAX_UPLOAD 0
116+
117+ # By default, Nginx listens on port 80.
118+ # To modify this, change LISTEN_PORT environment variable.
119+ # (in a Dockerfile or with an option for `docker run`)
120+ ENV LISTEN_PORT 80
121+
122+ # Which uWSGI .ini file should be used, to make it customizable
123+ ENV UWSGI_INI /app/uwsgi.ini
124+
125+ # URL under which static (not modified by Python) files will be requested
126+ # They will be served by Nginx directly, without being handled by uWSGI
127+ ENV STATIC_URL /static
128+ # Absolute path in where the static files wil be
129+ ENV STATIC_PATH /app/static
130+
131+ # If STATIC_INDEX is 1, serve / with /static/index.html directly (or the static URL configured)
132+ # ENV STATIC_INDEX 1
133+ ENV STATIC_INDEX 0
134+
135+ # Add demo app
136+ RUN git clone --recursive https://github.com/PaddlePaddle/continuous_evaluation
137+
138+ # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations.
139+ ENV PYTHONPATH=/app
140+ EXPOSE 80
141+
142+ # development image default do build work
143+ WORKDIR /continuous_evaluation/web/
144+ CMD = ["python3" , "main.py" ]
0 commit comments