FROM alpine:3.19 AS build RUN --mount=type=cache,target=/var/cache/apk/,sharing=locked \ apk update &&\ apk add python3 python3-dev openjdk21-jre pipx gcc g++ musl-dev linux-headers which curl libffi-dev RUN curl -O https://repo1.maven.org/maven2/dev/hcf/ganymede/ganymede/2.1.2.20230910/ganymede-2.1.2.20230910.jar RUN adduser luser --system -s /bin/sh -h /var/lib/jupyter USER luser WORKDIR /var/lib/jupyter RUN python -m venv venv RUN venv/bin/pip install numpy RUN venv/bin/pip install matplotlib RUN venv/bin/pip install jupyter-core RUN venv/bin/pip install jupyterhub RUN venv/bin/pip install jupyterlab RUN venv/bin/pip install notebook RUN venv/bin/pip install ipywidgets RUN venv/bin/pip install jupyterlab-lsp RUN venv/bin/pip install python-lsp-server[yapf,rope,pyflakes] RUN venv/bin/pip install pylsp-mypy ENV PATH="/var/lib/jupyter/venv/bin/:$PATH" RUN java -jar /ganymede-2.1.2.20230910.jar -i --copy-jar=true FROM alpine:3.19 RUN --mount=type=cache,target=/var/cache/apk/,sharing=locked \ apk update &&\ apk add python3 openjdk21-jre texlive texlive-xetex texlive-full RUN adduser luser --system -s /bin/sh -h /var/lib/jupyter USER luser WORKDIR /var/lib/jupyter COPY --from=build /var/lib/jupyter /var/lib/jupyter COPY jupyter_server_config.py docker_healthcheck.py /etc/jupyter/ COPY start-notebook.py start-singleuser.py /usr/local/bin/ ENV JUPYTER_PORT=8888 EXPOSE $JUPYTER_PORT ENV PATH="/var/lib/jupyter/venv/bin/:$PATH" CMD ["start-notebook.py"] # HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck # This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server`, and `retro` jupyter commands # https://github.com/jupyter/docker-stacks/issues/915#issuecomment-1068528799 HEALTHCHECK --interval=3s --timeout=1s --start-period=3s --retries=3 \ CMD /etc/jupyter/docker_healthcheck.py || exit 1