Skip to content

Commit 50434cb

Browse files
committed
Merge branch 'feature/jupyter_docker' into feature/python_trainer_api
2 parents 14fc57c + 7701908 commit 50434cb

File tree

7 files changed

+75
-5
lines changed

7 files changed

+75
-5
lines changed

paddle/scripts/docker/00_sshd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
/usr/sbin/sshd -D

paddle/scripts/docker/01_jupyter

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
jupyter notebook /notes/

paddle/scripts/docker/Dockerfile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN apt-get update \
1515
&& apt-get clean -y
1616
RUN cd /usr/src/gtest && cmake . && make && cp *.a /usr/lib
1717
RUN pip install -U BeautifulSoup docopt PyYAML pillow \
18-
sphinx sphinx_rtd_theme recommonmark
18+
sphinx sphinx_rtd_theme recommonmark jupyter
1919

2020
ARG WITH_AVX
2121
ARG WITH_DOC
@@ -43,4 +43,16 @@ RUN echo 'root:root' | chpasswd
4343
RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
4444
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
4545
EXPOSE 22
46-
CMD ["/usr/sbin/sshd", "-D"]
46+
47+
# Jupyter Notebook directory.
48+
RUN mkdir /notes/
49+
WORKDIR "/notes"
50+
EXPOSE 8888
51+
52+
RUN mkdir -p /opt/run
53+
COPY ./paddle/scripts/docker/jupyter_notebook_config.py /root/.jupyter/
54+
COPY ./paddle/scripts/docker/00_sshd /opt/run/
55+
COPY ./paddle/scripts/docker/01_jupyter /opt/run/
56+
COPY ./paddle/scripts/docker/run_all /opt/bin/
57+
58+
CMD ["/opt/bin/run_all"]

paddle/scripts/docker/Dockerfile.gpu

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN apt-get update \
1515
&& apt-get clean -y
1616
RUN cd /usr/src/gtest && cmake . && make && cp *.a /usr/lib
1717
RUN pip install -U BeautifulSoup docopt PyYAML pillow \
18-
sphinx sphinx_rtd_theme recommonmark
18+
sphinx sphinx_rtd_theme recommonmark jupyter
1919

2020
ARG WITH_AVX
2121
ARG WITH_DOC
@@ -43,4 +43,16 @@ RUN echo 'root:root' | chpasswd
4343
RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
4444
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
4545
EXPOSE 22
46-
CMD ["/usr/sbin/sshd", "-D"]
46+
47+
# Jupyter Notebook directory.
48+
RUN mkdir /notes/
49+
WORKDIR "/notes"
50+
EXPOSE 8888
51+
52+
RUN mkdir -p /opt/run
53+
COPY ./paddle/scripts/docker/jupyter_notebook_config.py /root/.jupyter/
54+
COPY ./paddle/scripts/docker/00_sshd /opt/run/
55+
COPY ./paddle/scripts/docker/01_jupyter /opt/run/
56+
COPY ./paddle/scripts/docker/run_all /opt/bin/
57+
58+
CMD ["/opt/bin/run_all"]

paddle/scripts/docker/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@ cp -rv /woboq/data $WOBOQ_OUT/../data
4343
-o $WOBOQ_OUT \
4444
-p paddle:/paddle
4545
/woboq/indexgenerator/codebrowser_indexgenerator $WOBOQ_OUT
46-
46+
cd /woboq
47+
make clean
48+
rm -rf /paddle/build
4749
trap : 0
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# from https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/docker/jupyter_notebook_config.py
2+
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ==============================================================================
16+
import os
17+
from IPython.lib import passwd
18+
19+
c.NotebookApp.ip = '*'
20+
c.NotebookApp.port = int(os.getenv('PORT', 8888))
21+
c.NotebookApp.open_browser = False
22+
c.MultiKernelManager.default_kernel_name = 'python2'
23+
24+
# sets a password if PASSWORD is set in the environment
25+
if 'PASSWORD' in os.environ:
26+
c.NotebookApp.password = passwd(os.environ['PASSWORD'])
27+
del os.environ['PASSWORD']

paddle/scripts/docker/run_all

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
# http://stackoverflow.com/questions/18805073/docker-multiple-entrypoints
3+
4+
LOG=/var/log/all
5+
6+
touch $LOG
7+
8+
for a in /opt/run/*
9+
do
10+
$a >> $LOG &
11+
done
12+
13+
tail -f $LOG

0 commit comments

Comments
 (0)