From 165286b3028ab4bedfd0fe5727ddb30715adf3e0 Mon Sep 17 00:00:00 2001
From: Olivier Benz <olivier.benz@b-data.ch>
Date: Tue, 28 Jan 2025 08:35:42 +0100
Subject: [PATCH] Set and use environment variable JUPYTER_PORT

---
 base/conf/jupyter/etc/jupyter/jupyter_server_config.py | 1 -
 base/latest.Dockerfile                                 | 5 ++++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/base/conf/jupyter/etc/jupyter/jupyter_server_config.py b/base/conf/jupyter/etc/jupyter/jupyter_server_config.py
index 5269c78..bc03f5a 100644
--- a/base/conf/jupyter/etc/jupyter/jupyter_server_config.py
+++ b/base/conf/jupyter/etc/jupyter/jupyter_server_config.py
@@ -11,7 +11,6 @@ from jupyter_core.paths import jupyter_data_dir
 
 c = get_config()  # noqa: F821 # type: ignore
 c.ServerApp.ip = "0.0.0.0"
-c.ServerApp.port = 8888
 #c.ServerApp.open_browser = False
 
 # https://github.com/jupyter/notebook/issues/3130
diff --git a/base/latest.Dockerfile b/base/latest.Dockerfile
index 87253eb..cb455f8 100644
--- a/base/latest.Dockerfile
+++ b/base/latest.Dockerfile
@@ -500,7 +500,10 @@ RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master
 COPY --from=files /files /
 COPY --from=files /files/var/backups/skel ${HOME}
 
-EXPOSE 8888
+ARG JUPYTER_PORT=8888
+ENV JUPYTER_PORT=${JUPYTER_PORT}
+
+EXPOSE $JUPYTER_PORT
 
 ## Configure container startup
 ENTRYPOINT ["tini", "-g", "--", "start.sh"]
-- 
GitLab