######################################################################
ARG BASE_IMAGE=ubuntu:22.04
######################################################################
FROM --platform=${BUILDPLATFORM:-linux/amd64} $BASE_IMAGE AS jupyterhub-builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq
&& apt-get install -yqq --no-install-recommends
build-essential
ca-certificates
curl
locales
python3-dev
python3-pip
python3-pycurl
python3-venv
&& python3 -m pip install --no-cache-dir --upgrade setuptools pip build wheel
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
&& apt-get install -yqq --no-install-recommends
nodejs
&& npm install --global yarn
WORKDIR /src/jupyterhub
COPY . .
ARG PIP_CACHE_DIR=/tmp/pip-cache
RUN --mount=type=cache,target=${PIP_CACHE_DIR}
python3 -m build --wheel
######################################################################
FROM $BASE_IMAGE AS wheel-builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq
&& apt-get install -yqq --no-install-recommends
build-essential
ca-certificates
curl
locales
python3-dev
python3-pip
python3-pycurl
python3-venv
&& python3 -m pip install --no-cache-dir --upgrade setuptools pip build wheel
WORKDIR /src/jupyterhub
COPY --from=jupyterhub-builder /src/jupyterhub/dist/.whl /src/jupyterhub/dist/
ARG PIP_CACHE_DIR=/tmp/pip-cache
RUN --mount=type=cache,target=${PIP_CACHE_DIR}
python3 -m pip wheel --wheel-dir wheelhouse dist/.whl
######################################################################
FROM $BASE_IMAGE AS jupyterhub
ENV DEBIAN_FRONTEND=noninteractive
SHELL=/bin/bash
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
PYTHONDONTWRITEBYTECODE=1
EXPOSE 8000
LABEL maintainer="Jupyter Project jupyter@googlegroups.com" LABEL org.jupyter.service="jupyterhub"
WORKDIR /srv/jupyterhub
RUN apt-get update -qq
&& apt-get install -yqq --no-install-recommends
ca-certificates
curl
gnupg
locales
python-is-python3
python3-pip
python3-pycurl
nodejs
npm
&& locale-gen $LC_ALL
&& npm install -g configurable-http-proxy@^4.2.0 \
&& rm -rf /var/lib/apt/lists/* /var/log/* /var/tmp/* ~/.npm
RUN --mount=type=cache,from=wheel-builder,source=/src/jupyterhub/wheelhouse,target=/tmp/wheelhouse
# always make sure pip is up to date!
python3 -m pip install --no-compile --no-cache-dir --upgrade setuptools pip
&& python3 -m pip install --no-compile --no-cache-dir /tmp/wheelhouse/*
CMD ["jupyterhub"]
Return to Top