From 5c41384e17eb85db89dc0fd19d25208836047453 Mon Sep 17 00:00:00 2001 From: Matthew Connelly Date: Wed, 17 Aug 2022 13:53:57 +0100 Subject: [PATCH] initial commit Adds the Dockerfile, entrypoint and default config. --- Dockerfile | 33 ++++++++ LICENSE | 20 +---- README.md | 5 +- conf.py | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++ entrypoint.sh | 14 ++++ 5 files changed, 267 insertions(+), 18 deletions(-) create mode 100644 Dockerfile create mode 100644 conf.py create mode 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e5abeb8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM python:buster as build + +RUN apt update && \ + apt upgrade -y && \ + pip install virtualenv && \ + virtualenv /v + +RUN . /v/bin/activate && \ + pip install \ + --no-cache-dir \ + -U \ + jupyterlab \ + notebook \ + voila \ + nodeenv && \ + nodeenv -p + +FROM python:slim as run + +COPY --from=build /v /v + +RUN mkdir /data /root/.jupyter +COPY entrypoint.sh /e +COPY conf.py /.default.py + +WORKDIR /data +VOLUME /data +VOLUME /root/.jupyter + +EXPOSE 8888 +ENTRYPOINT ["/e"] +CMD ["jupyter-lab"] + diff --git a/LICENSE b/LICENSE index 4f82468..2071b23 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,9 @@ MIT License -Copyright (c) 2022 Matthew Connelly +Copyright (c) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 89c9ce6..2e18a93 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -# docker-jupyterlab-simple -Very simple JupyterLab container +# jupyter-alpine + +Alpine Linux-based container with an extremely basic JupyterLab (and related packages) setup \ No newline at end of file diff --git a/conf.py b/conf.py new file mode 100644 index 0000000..944e2e5 --- /dev/null +++ b/conf.py @@ -0,0 +1,213 @@ +# c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S' +# c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s' + +# Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'], default 30 +c.Application.log_level = 'INFO' + +# c.Application.logging_config = {} +# c.Application.show_config = False +# c.Application.show_config_json = False + +# c.JupyterApp.answer_yes = False +# c.JupyterApp.config_file = '' +# c.JupyterApp.config_file_name = '' +# c.JupyterApp.generate_config = False +# c.JupyterApp.log_datefmt = '%Y-%m-%d %H:%M:%S' +# c.JupyterApp.log_format = '[%(name)s]%(highlevel)s %(message)s' +# c.JupyterApp.log_level = 30 +# c.JupyterApp.logging_config = {} +# c.JupyterApp.show_config = False +# c.JupyterApp.show_config_json = False +# c.ExtensionApp.answer_yes = False +# c.ExtensionApp.config_file = '' +# c.ExtensionApp.config_file_name = '' +# c.ExtensionApp.default_url = '' +# c.ExtensionApp.generate_config = False +# c.ExtensionApp.handlers = [] +# c.ExtensionApp.log_datefmt = '%Y-%m-%d %H:%M:%S' +# c.ExtensionApp.log_format = '[%(name)s]%(highlevel)s %(message)s' +# c.ExtensionApp.log_level = 30 +# c.ExtensionApp.logging_config = {} +c.ExtensionApp.open_browser = False +# c.ExtensionApp.settings = {} +# c.ExtensionApp.show_config = False +# c.ExtensionApp.show_config_json = False +# c.ExtensionApp.static_paths = [] +# c.ExtensionApp.static_url_prefix = '' +# c.ExtensionApp.template_paths = [] + +# c.LabServerApp.allowed_extensions_uris = '' +# c.LabServerApp.answer_yes = False +# c.LabServerApp.app_settings_dir = '' +# c.LabServerApp.app_url = '/lab' +# c.LabServerApp.blacklist_uris = '' +# c.LabServerApp.blocked_extensions_uris = '' +# c.LabServerApp.cache_files = True +# c.LabServerApp.config_file = '' +# c.LabServerApp.config_file_name = '' +# c.LabServerApp.extra_labextensions_path = [] +# c.LabServerApp.generate_config = False +# c.LabServerApp.handlers = [] +# c.LabServerApp.jinja2_options = {} +# c.LabServerApp.labextensions_path = [] +# c.LabServerApp.labextensions_url = '' +# c.LabServerApp.listings_refresh_seconds = 3600 +# c.LabServerApp.listings_request_options = {} +# c.LabServerApp.listings_url = '' +# c.LabServerApp.log_datefmt = '%Y-%m-%d %H:%M:%S' +# c.LabServerApp.log_format = '[%(name)s]%(highlevel)s %(message)s' +# c.LabServerApp.log_level = 30 +# c.LabServerApp.logging_config = {} +# c.LabServerApp.notebook_starts_kernel = True +c.LabServerApp.open_browser = False +# c.LabServerApp.schemas_dir = '' +# c.LabServerApp.settings = {} +# c.LabServerApp.settings_url = '' +# c.LabServerApp.show_config = False +# c.LabServerApp.show_config_json = False +# c.LabServerApp.static_dir = '' +# c.LabServerApp.static_paths = [] +# c.LabServerApp.static_url_prefix = '' +# c.LabServerApp.template_paths = [] +# c.LabServerApp.templates_dir = '' +# c.LabServerApp.themes_dir = '' +# c.LabServerApp.themes_url = '' +# c.LabServerApp.translations_api_url = '' +# c.LabServerApp.tree_url = '' +# c.LabServerApp.user_settings_dir = '' +# c.LabServerApp.whitelist_uris = '' +# c.LabServerApp.workspaces_api_url = '' +# c.LabServerApp.workspaces_dir = '' +# c.LabApp.allowed_extensions_uris = '' +# c.LabApp.answer_yes = False +# c.LabApp.app_dir = None +# c.LabApp.app_settings_dir = '' +# c.LabApp.app_url = '/lab' +# c.LabApp.blacklist_uris = '' +# c.LabApp.blocked_extensions_uris = '' +# c.LabApp.cache_files = True +# c.LabApp.collaborative = False +# c.LabApp.config_file = '' +# c.LabApp.config_file_name = '' +# c.LabApp.core_mode = False +# c.LabApp.default_url = '/lab' +# c.LabApp.dev_mode = False +# c.LabApp.expose_app_in_browser = False +# c.LabApp.extensions_in_dev_mode = False +# c.LabApp.extra_labextensions_path = [] +# c.LabApp.generate_config = False +# c.LabApp.handlers = [] +# c.LabApp.jinja2_options = {} +# c.LabApp.labextensions_path = [] +# c.LabApp.labextensions_url = '' +# c.LabApp.listings_refresh_seconds = 3600 +# c.LabApp.listings_request_options = {} +# c.LabApp.listings_url = '' +# c.LabApp.log_datefmt = '%Y-%m-%d %H:%M:%S' +# c.LabApp.log_format = '[%(name)s]%(highlevel)s %(message)s' +# c.LabApp.log_level = 30 +# c.LabApp.logging_config = {} +# c.LabApp.notebook_starts_kernel = True +c.LabApp.open_browser = False +# c.LabApp.override_static_url = '' +# c.LabApp.override_theme_url = '' +# c.LabApp.schemas_dir = '' +# c.LabApp.settings = {} +# c.LabApp.settings_url = '' +# c.LabApp.show_config = False +# c.LabApp.show_config_json = False +# c.LabApp.splice_source = False +# c.LabApp.static_dir = '' +# c.LabApp.static_paths = [] +# c.LabApp.static_url_prefix = '' +# c.LabApp.template_paths = [] +# c.LabApp.templates_dir = '' +# c.LabApp.themes_dir = '' +# c.LabApp.themes_url = '' +# c.LabApp.translations_api_url = '' +# c.LabApp.tree_url = '' +# c.LabApp.user_settings_dir = '/root/.jupyter/lab/user-settings' +# c.LabApp.watch = False +# c.LabApp.whitelist_uris = '' +# c.LabApp.workspaces_api_url = '' +# c.LabApp.workspaces_dir = '/root/.jupyter/lab/workspaces' + +# c.ServerApp.allow_credentials = False +# c.ServerApp.allow_origin = '' +# c.ServerApp.allow_origin_pat = '' +# c.ServerApp.allow_password_change = True +c.ServerApp.allow_remote_access = True +c.ServerApp.allow_root = True +# c.ServerApp.answer_yes = False +c.ServerApp.authenticate_prometheus = False +# c.ServerApp.authorizer_class = 'jupyter_server.auth.authorizer.AllowAllAuthorizer' +# c.ServerApp.autoreload = False +# c.ServerApp.base_url = '/' +# c.ServerApp.browser = '' +# c.ServerApp.certfile = '' +# c.ServerApp.client_ca = '' +# c.ServerApp.config_file = '' +# c.ServerApp.config_file_name = '' +# c.ServerApp.config_manager_class = 'jupyter_server.services.config.manager.ConfigManager' +# c.ServerApp.contents_manager_class = 'jupyter_server.services.contents.largefilemanager.LargeFileManager' +# c.ServerApp.cookie_options = {} +# c.ServerApp.cookie_secret = b'' +# c.ServerApp.cookie_secret_file = '' +# c.ServerApp.custom_display_url = '' +# c.ServerApp.default_url = '/' +# c.ServerApp.disable_check_xsrf = False +# c.ServerApp.extra_services = [] +# c.ServerApp.extra_static_paths = [] +# c.ServerApp.extra_template_paths = [] +# c.ServerApp.file_to_run = '' +# c.ServerApp.file_url_prefix = 'notebooks' +# c.ServerApp.generate_config = False +# c.ServerApp.get_secure_cookie_kwargs = {} +# c.ServerApp.iopub_data_rate_limit = 1000000 +# c.ServerApp.iopub_msg_rate_limit = 1000 +c.ServerApp.ip = '0.0.0.0' +# c.ServerApp.jinja_environment_options = {} +# c.ServerApp.jinja_template_vars = {} +# c.ServerApp.jpserver_extensions = {} +# c.ServerApp.kernel_manager_class = 'jupyter_server.services.kernels.kernelmanager.MappingKernelManager' +# c.ServerApp.kernel_ws_protocol = None +# c.ServerApp.keyfile = '' +# c.ServerApp.limit_rate = True +# c.ServerApp.local_hostnames = ['localhost'] +# c.ServerApp.log_datefmt = '%Y-%m-%d %H:%M:%S' +# c.ServerApp.log_format = '[%(name)s]%(highlevel)s %(message)s' +# c.ServerApp.log_level = 30 +# c.ServerApp.logging_config = {} +# c.ServerApp.login_handler_class = 'jupyter_server.auth.login.LoginHandler' +# c.ServerApp.logout_handler_class = 'jupyter_server.auth.logout.LogoutHandler' +# c.ServerApp.max_body_size = 536870912 +# c.ServerApp.max_buffer_size = 536870912 +# c.ServerApp.min_open_files_limit = 0 +# c.ServerApp.notebook_dir = '' +c.ServerApp.open_browser = False +# c.ServerApp.password = '' +# c.ServerApp.password_required = False +# c.ServerApp.port = 0 +# c.ServerApp.port_retries = 50 +# c.ServerApp.preferred_dir = '' +# c.ServerApp.pylab = 'disabled' +# c.ServerApp.quit_button = True +# c.ServerApp.rate_limit_window = 3 +# c.ServerApp.reraise_server_extension_failures = False +c.ServerApp.root_dir = '/data' +# c.ServerApp.session_manager_class = 'builtins.object' +# c.ServerApp.show_config = False +# c.ServerApp.show_config_json = False +# c.ServerApp.shutdown_no_activity_timeout = 0 +# c.ServerApp.sock = '' +# c.ServerApp.sock_mode = '0600' +# c.ServerApp.ssl_options = {} +# c.ServerApp.terminado_settings = {} +# c.ServerApp.terminals_enabled = True +# c.ServerApp.token = '' +# c.ServerApp.tornado_settings = {} +# c.ServerApp.trust_xheaders = False +c.ServerApp.use_redirect_file = False +# c.ServerApp.webbrowser_open_new = 2 +# c.ServerApp.websocket_compression_options = None +# c.ServerApp.websocket_url = '' diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..7077ebf --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/sh -x +VENVDIR=/v +DATADIR=/data +JUPYDIR=/root/.jupyter + +JUPYDEF=/.default.py +JUPYCNF=$JUPYDIR/jupyter_lab_config.py + +cd $DATADIR +. $VENVDIR/bin/activate + +[ ! -f $JUPYCNF ] && cp $JUPYDEF $JUPYCNF + +( $@ )