Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Run JupyterHub with Python 3.8 #12

Merged
merged 1 commit into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ansible/roles/jupyterhub/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@
set_fact:
lti11_shared_secret_result={{ _lti11_shared_secret_result.stdout }}

- name: copy the jupyterhub configuration file
copy:
src: jupyterhub_config.py
dest: "{{ working_dir }}/jupyterhub_config.py"

- name: copy requirements.txt for base jupyterhub image
copy:
src: requirements.txt
dest: "{{ working_dir }}/jupyterhub-requirements.txt"

- name: copy the jupyterhub configuration file
copy:
src: jupyterhub_config.py
dest: "{{ working_dir }}/jupyterhub_config.py"

- name: copy postgres utility scripts
copy:
src: wait-for-postgres.sh
Expand Down
25 changes: 16 additions & 9 deletions ansible/roles/jupyterhub/templates/Dockerfile.jhub.j2
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
ARG BASE_IMAGE={{docker_jhub_base_image}}
ARG BASE_IMAGE=ubuntu:bionic-20200311
FROM $BASE_IMAGE

ENV PYTHONPATH=/usr/local/lib/python3.6/dist-packages:$PYTHONPATH

# always make sure pip is up to date!
RUN python3 -m pip install --no-cache --upgrade setuptools pip

RUN apt-get update \
&& apt-get install -yq --no-install-recommends \
apt-utils \
fonts-liberation \
git \
libpq-dev \
nano \
postgresql-client \
software-properties-common \
sudo \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN add-apt-repository ppa:deadsnakes/ppa \
&& apt-get install -y \
python3.8 \
python3-pip

ENV PYTHONPATH=/usr/local/lib/python3.8/dist-packages:$PYTHONPATH

# always make sure pip is up to date!
RUN python3 -m pip install --no-cache --upgrade setuptools pip

# Enable prompt color in the skeleton .bashrc before creating the default JH_USER
RUN sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashrc

Expand All @@ -39,17 +46,17 @@ COPY share/templates/. /usr/local/share/jupyterhub/templates/.
# /etc/jupyterhub/jupyterhub_config.py by default
COPY jupyterhub_config.py /etc/jupyterhub/jupyterhub_config.py

WORKDIR /srv/jupyterhub

# Get cull-idle from jupyterhub examples folder
RUN wget https://raw.githubusercontent.com/jupyterhub/jupyterhub/d126baa443ad7d893be2ff4a70afe9ef5b8a4a1a/examples/cull-idle/cull_idle_servers.py

WORKDIR /srv/jupyterhub

# Copy postgres util script and update permissions
COPY wait-for-postgres.sh /srv/jupyterhub/wait-for-postgres.sh
RUN chmod +x /srv/jupyterhub/wait-for-postgres.sh

# Run standard command but wait for postgres
# https://docs.docker.com/compose/startup-order/
CMD ["/srv/jupyterhub/wait-for-postgres.sh", "python3", "jupyterhub", "-f", "/etc/jupyterhub/jupyterhub_config.py"]
CMD ["/srv/jupyterhub/wait-for-postgres.sh", "python3.8", "jupyterhub", "-f", "/etc/jupyterhub/jupyterhub_config.py"]

HEALTHCHECK CMD curl --fail http://localhost:8081/ || exit 1