diff --git a/Dockerfile b/Dockerfile index 949359b..fd97d36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,9 @@ RUN pip3 --no-cache-dir install \ #sklearn \ #pandas \ && \ - python3 -m ipykernel.kernelspec + python3 -m ipykernel.kernelspec + +COPY jupyter_notebook_config.py /root/.jupyter/ # Copy sample notebooks. COPY notebooks /notebooks @@ -37,4 +39,4 @@ EXPOSE 6006 8888 WORKDIR /notebooks -CMD jupyter lab --ip=0.0.0.0 --no-browser --allow-root \ No newline at end of file +CMD jupyter lab --ip=* --no-browser --allow-root \ No newline at end of file diff --git a/Makefile b/Makefile index d3c081d..ad41f6f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ NAME ?= elswork/tf-jupyterlab + +start: + docker run -d -p 8888:8888 -p 0.0.0.0:6006:6006 --restart=unless-stopped $(NAME):latest build: docker build --no-cache -t $(NAME):latest --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ --build-arg VCS_REF=`git rev-parse --short HEAD` \ @@ -11,6 +14,8 @@ push: docker push $(NAME):latest deploy: build tag push +start-arm: + docker run -d -p 8888:8888 -p 0.0.0.0:6006:6006 --restart=unless-stopped $(NAME):arm32v7 build-arm: docker build --no-cache -t $(NAME):arm32v7 --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ --build-arg VCS_REF=`git rev-parse --short HEAD` \ diff --git a/jupyter_notebook_config.py b/jupyter_notebook_config.py new file mode 100644 index 0000000..abd52bf --- /dev/null +++ b/jupyter_notebook_config.py @@ -0,0 +1,35 @@ +# Copyright 2015 The TensorFlow Authors. All Rights Reserved. +# +# Licensed 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. +# ============================================================================== +import os +from IPython.lib import passwd + +c.NotebookApp.ip = '*' +c.NotebookApp.port = int(os.getenv('PORT', 8888)) +c.NotebookApp.open_browser = False +# This is unsecure, only for testing purpouses +c.NotebookApp.allow_origin = '*' +c.NotebookApp.allow_remote_access = True +#======================================== +c.MultiKernelManager.default_kernel_name = 'python3' + +# sets a password if PASSWORD is set in the environment +if 'PASSWORD' in os.environ: + password = os.environ['PASSWORD'] + if password: + c.NotebookApp.password = passwd(password) + else: + c.NotebookApp.password = '' + c.NotebookApp.token = '' + del os.environ['PASSWORD']