50 lines
1.7 KiB
Docker
50 lines
1.7 KiB
Docker
# Systemd inside a Docker container, for CI only
|
|
FROM ubuntu:22.10
|
|
|
|
# Configure Ubuntu with SystemD
|
|
RUN export DEBIAN_FRONTEND=noninteractive TZ=America/Los_Angeles \
|
|
&& apt-get update -y \
|
|
&& apt-get upgrade -y \
|
|
&& apt-get install -y \
|
|
systemd \
|
|
curl \
|
|
git \
|
|
sudo \
|
|
python3-pip python3-venv \
|
|
&& rm -rfv /var/lib/apt/lists/* \
|
|
&& find /etc/systemd/system /lib/systemd/system \
|
|
-path '*.wants/*' \
|
|
-not -name '*journald*' \
|
|
-not -name '*systemd-tmpfiles*' \
|
|
-not -name '*systemd-user-sessions*' \
|
|
-exec rm -fv {} \;
|
|
|
|
# Some required environment variables....
|
|
ENV TLJH_BOOTSTRAP_DEV=yes \
|
|
TLJH_BOOTSTRAP_PIP_SPEC=/srv/src \
|
|
PATH=/opt/tljh/hub/bin:${PATH}
|
|
|
|
# Tell SystemD to start up...
|
|
RUN systemctl set-default multi-user.target
|
|
|
|
# Download the repository into its expected location
|
|
# and run the bootstrapper to initialize the service.
|
|
ARG TLJH_ADMIN_USERNAME="admin"
|
|
ARG TLJH_ADMIN_PASSWORD="admin"
|
|
ARG TLJH_REPO="https://github.com/jupyterhub/the-littlest-jupyterhub"
|
|
RUN git clone --depth=1 "$TLJH_REPO" /srv/src && rm -rf /srv/src/.git
|
|
|
|
# Preinstall everything needed, this will fail when it tries to start up tljh
|
|
RUN python3 /srv/src/bootstrap/bootstrap.py --admin "$TLJH_ADMIN_USERNAME:$TLJH_ADMIN_PASSWORD" || true
|
|
|
|
# Finish running the installer as first thing when systemd is up
|
|
RUN CRED="$TLJH_ADMIN_USERNAME:$TLJH_ADMIN_PASSWORD" \
|
|
&& echo '#!/bin/bash' > /etc/rc.local \
|
|
&& echo "/opt/tljh/hub/bin/python3 -m tljh.installer --admin '$CRED'" >> /etc/rc.local \
|
|
&& chmod 755 /etc/rc.local
|
|
|
|
# This is what's running on container startup
|
|
CMD ["/lib/systemd/systemd", "--log-target=journal"]
|
|
EXPOSE 80/tcp
|
|
STOPSIGNAL SIGRTMIN+3
|