Skip to content

Commit 2b6787c

Browse files
authored
add jupyterhub to docker (#105)
* adding jupyterhub to docker * add PRODUCTION env in yaml
1 parent 7c6b908 commit 2b6787c

File tree

6 files changed

+2845
-5
lines changed

6 files changed

+2845
-5
lines changed

.azure/aci-deploy.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ properties:
88
environmentVariables:
99
- name: SSH_USERS
1010
value: "{SSH_USERS}"
11+
- name: PRODUCTION
12+
value: "true"
1113
image: undpgeohub.azurecr.io/undp-data/geo-cb-surge:main
1214
ports:
1315
- port: 22
16+
- port: 443
1417
resources:
1518
requests:
1619
cpu: 4
@@ -28,6 +31,7 @@ properties:
2831
type: Public
2932
ports:
3033
- port: 22
34+
- port: 443
3135
dnsNameLabel: cbsurge-rapida
3236
volumes:
3337
- name: fileshare-volume

Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ FROM ghcr.io/osgeo/gdal:ubuntu-full-3.10.0
44
ARG GROUPNAME="cbsurge"
55

66
# Install necessary tools and Python packages
7-
RUN apt-get update && \
8-
apt-get install -y python3-pip pipenv gcc cmake libgeos-dev openssh-server && \
7+
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
8+
apt-get update && \
9+
apt-get install -y python3-pip pipenv \
10+
gcc cmake libgeos-dev \
11+
openssh-server \
12+
ca-certificates curl gnupg nodejs && \
913
apt-get clean && \
10-
rm -rf /var/lib/apt/lists/*
14+
rm -rf /var/lib/apt/lists/* && \
15+
npm install -g configurable-http-proxy
1116

1217
# install azure-cli
1318
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash

docker-compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ services:
77
volumes:
88
- ./create_user.sh:/app/create_user.sh
99
- ./entrypoint.sh:/app/entrypoint.sh
10+
- ./jupyterhub_config.py:/app/jupyterhub_config.py
1011
- ./Makefile:/app/Makefile
1112
- ./cbsurge:/app/cbsurge # mount app folder to container
1213
- ./tests:/app/tests
1314
entrypoint: "/app/entrypoint.sh"
15+
# entrypoint: "pipenv run jupyterhub"
1416
ports:
1517
- 2222:22
18+
- 8100:8000
1619
environment:
1720
- SSH_USERS=${SSH_USERS:-''}

entrypoint.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,15 @@ if [ ! -z "$SSH_USERS" ]; then
1313
done
1414
fi
1515

16-
# launch ssh server
17-
/usr/sbin/sshd -D
16+
# Determine the port based on the PRODUCTION environment variable
17+
if [ "$PRODUCTION" = "true" ]; then
18+
JUPYTER_PORT=443
19+
else
20+
JUPYTER_PORT=8000
21+
fi
22+
23+
# Start SSH server in the background
24+
/usr/sbin/sshd -D &
25+
26+
# Start JupyterLab in the foreground (so the container keeps running)
27+
pipenv run jupyterhub -f jupyterhub_config.py --port=$JUPYTER_PORT

0 commit comments

Comments
 (0)