2016-11-07 19:38:54 +01:00
|
|
|
FROM jupyterhub/jupyterhub
|
|
|
|
|
|
|
|
ARG HTTP_PROXY=
|
|
|
|
ARG HTTPS_PROXY=
|
|
|
|
ARG http_proxy=
|
|
|
|
ARG https_proxy=
|
|
|
|
|
|
|
|
ARG TUTOR_USERNAME=tutor
|
|
|
|
ARG TUTOR_PASSWORD=tutor
|
|
|
|
|
|
|
|
RUN apt-get update -y \
|
2018-08-24 12:29:26 +02:00
|
|
|
&& apt-get install -y curl ca-certificates gnupg2 \
|
2020-04-01 17:17:14 +02:00
|
|
|
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
|
2016-11-07 19:38:54 +01:00
|
|
|
&& apt-get install -y nodejs libzmq3-dev mcrypt
|
|
|
|
|
|
|
|
RUN pip install jupyter
|
|
|
|
|
2018-08-24 12:29:26 +02:00
|
|
|
RUN npm install --unsafe-perm -g ijavascript &&\
|
|
|
|
ijs --ijs-install=global
|
2016-11-07 19:38:54 +01:00
|
|
|
|
|
|
|
RUN useradd -m $TUTOR_USERNAME \
|
|
|
|
&& echo "$TUTOR_USERNAME:$TUTOR_PASSWORD" | chpasswd
|
|
|
|
|
|
|
|
RUN mkdir -p /home/$TUTOR_USERNAME/lessons \
|
|
|
|
&& mkdir -p /home/$TUTOR_USERNAME/students \
|
|
|
|
&& chown -R $TUTOR_USERNAME: /home/$TUTOR_USERNAME
|
|
|
|
|
|
|
|
RUN echo "TUTOR_USERNAME=$TUTOR_USERNAME" > /srv/jupyterhub/tutor.conf
|
|
|
|
|
|
|
|
ADD create-hub-student.sh /usr/local/bin/create-hub-student
|
|
|
|
RUN chmod +x /usr/local/bin/create-hub-student
|
|
|
|
|
|
|
|
RUN mkdir -p /etc/jupyterhub \
|
|
|
|
&& cd /etc/jupyterhub \
|
|
|
|
&& jupyterhub --generate-config \
|
|
|
|
&& sed -i "s/^#c.Authenticator.admin_users = set()$/c.Authenticator.admin_users = set(['$TUTOR_USERNAME'])/" jupyterhub_config.py \
|
|
|
|
&& sed -i "s/^#c.LocalAuthenticator.create_system_users = False$/c.LocalAuthenticator.create_system_users = True/" jupyterhub_config.py \
|
|
|
|
&& sed -i "s/^#c.LocalAuthenticator.add_user_cmd = \[\]$/c.LocalAuthenticator.add_user_cmd = ['\/usr\/local\/bin\/create-hub-student']/" jupyterhub_config.py
|
|
|
|
|
|
|
|
CMD ["jupyterhub", "--config", "/etc/jupyterhub/jupyterhub_config.py"]
|