diff --git a/.github/workflows/registry-overviews.yml b/.github/workflows/registry-overviews.yml deleted file mode 100644 index b4a0b528..00000000 --- a/.github/workflows/registry-overviews.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Update Registry overviews - -env: - OWNER: ${{ github.repository_owner }} - -on: - push: - branches: - - main - paths: - - ".github/workflows/registry-overviews.yml" - - - "README.md" - - "onbuild/README.md" - - "demo-image/README.md" - - "singleuser/README.md" - workflow_dispatch: - -jobs: - update-overview: - runs-on: ubuntu-latest - name: update-overview (${{matrix.image}}) - if: github.repository_owner == 'jupyterhub' - - steps: - - name: Checkout Repo ⚡️ - uses: actions/checkout@v4 - - - name: Push README to Registry 🐳 - uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1 - env: - DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }} - with: - destination_container_repo: ${{ env.OWNER }}/${{ matrix.image }} - provider: dockerhub - short_description: ${{ matrix.description }} - readme_file: ${{ matrix.readme_file }} - - strategy: - matrix: - include: - - image: jupyterhub - description: "JupyterHub: multi-user Jupyter notebook server" - readme_file: README.md - - image: jupyterhub-onbuild - description: onbuild version of JupyterHub images - readme_file: onbuild/README.md - - image: jupyterhub-demo - description: Demo JupyterHub Docker image with a quick overview of what JupyterHub is and how it works - readme_file: demo-image/README.md - - image: singleuser - description: "single-user docker images for use with JupyterHub and DockerSpawner see also: jupyter/docker-stacks" - readme_file: singleuser/README.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e5066f12..f99fd27a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ # This is a GitHub workflow defining a set of jobs with a set of steps. # ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions # -# Test build release artifacts (PyPI package, Docker images) and publish them on +# Test build release artifacts (PyPI package) and publish them on # pushed git tags. # name: Release @@ -82,152 +82,3 @@ jobs: run: | pip install twine twine upload --skip-existing dist/* - - publish-docker: - runs-on: ubuntu-22.04 - timeout-minutes: 30 - # temporarily disabled - if: false - - services: - # So that we can test this in PRs/branches - local-registry: - image: registry:2 - ports: - - 5000:5000 - - steps: - - name: Should we push this image to a public registry? - run: | - if [ "${{ startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main') }}" = "true" ]; then - echo "REGISTRY=quay.io/" >> $GITHUB_ENV - else - echo "REGISTRY=localhost:5000/" >> $GITHUB_ENV - fi - - - uses: actions/checkout@v4 - - # Setup docker to build for multiple platforms, see: - # https://github.com/docker/build-push-action/tree/v2.4.0#usage - # https://github.com/docker/build-push-action/blob/v2.4.0/docs/advanced/multi-platform.md - - name: Set up QEMU (for docker buildx) - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx (for multi-arch builds) - uses: docker/setup-buildx-action@v3 - with: - # Allows pushing to registry on localhost:5000 - driver-opts: network=host - - - name: Setup push rights to Docker Hub - # This was setup by... - # 1. Creating a [Robot Account](https://quay.io/organization/jupyterhub?tab=robots) in the JupyterHub - # . Quay.io org - # 2. Giving it enough permissions to push to the jupyterhub and singleuser images - # 3. Putting the robot account's username and password in GitHub actions environment - if: env.REGISTRY != 'localhost:5000/' - run: | - docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" "${{ env.REGISTRY }}" - docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_TOKEN }}" docker.io - - # image: jupyterhub/jupyterhub - # - # https://github.com/jupyterhub/action-major-minor-tag-calculator - # If this is a tagged build this will return additional parent tags. - # E.g. 1.2.3 is expanded to Docker tags - # [{prefix}:1.2.3, {prefix}:1.2, {prefix}:1, {prefix}:latest] unless - # this is a backported tag in which case the newer tags aren't updated. - # For branches this will return the branch name. - # If GITHUB_TOKEN isn't available (e.g. in PRs) returns no tags []. - - name: Get list of jupyterhub tags - id: jupyterhubtags - uses: jupyterhub/action-major-minor-tag-calculator@v3 - with: - githubToken: ${{ secrets.GITHUB_TOKEN }} - prefix: >- - ${{ env.REGISTRY }}jupyterhub/jupyterhub: - jupyterhub/jupyterhub: - defaultTag: "${{ env.REGISTRY }}jupyterhub/jupyterhub:noref" - branchRegex: ^\w[\w-.]*$ - - - name: Build and push jupyterhub - uses: docker/build-push-action@v6 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - # tags parameter must be a string input so convert `gettags` JSON - # array into a comma separated list of tags - tags: ${{ join(fromJson(steps.jupyterhubtags.outputs.tags)) }} - - # image: jupyterhub/jupyterhub-onbuild - # - - name: Get list of jupyterhub-onbuild tags - id: onbuildtags - uses: jupyterhub/action-major-minor-tag-calculator@v3 - with: - githubToken: ${{ secrets.GITHUB_TOKEN }} - prefix: >- - ${{ env.REGISTRY }}jupyterhub/jupyterhub-onbuild: - jupyterhub/jupyterhub-onbuild: - defaultTag: "${{ env.REGISTRY }}jupyterhub/jupyterhub-onbuild:noref" - branchRegex: ^\w[\w-.]*$ - - - name: Build and push jupyterhub-onbuild - uses: docker/build-push-action@v6 - with: - build-args: | - BASE_IMAGE=${{ fromJson(steps.jupyterhubtags.outputs.tags)[0] }} - context: onbuild - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ join(fromJson(steps.onbuildtags.outputs.tags)) }} - - # image: jupyterhub/jupyterhub-demo - # - - name: Get list of jupyterhub-demo tags - id: demotags - uses: jupyterhub/action-major-minor-tag-calculator@v3 - with: - githubToken: ${{ secrets.GITHUB_TOKEN }} - prefix: >- - ${{ env.REGISTRY }}jupyterhub/jupyterhub-demo: - jupyterhub/jupyterhub-demo: - defaultTag: "${{ env.REGISTRY }}jupyterhub/jupyterhub-demo:noref" - branchRegex: ^\w[\w-.]*$ - - - name: Build and push jupyterhub-demo - uses: docker/build-push-action@v6 - with: - build-args: | - BASE_IMAGE=${{ fromJson(steps.onbuildtags.outputs.tags)[0] }} - context: demo-image - # linux/arm64 currently fails: - # ERROR: Could not build wheels for argon2-cffi which use PEP 517 and cannot be installed directly - # ERROR: executor failed running [/bin/sh -c python3 -m pip install notebook]: exit code: 1 - platforms: linux/amd64 - push: true - tags: ${{ join(fromJson(steps.demotags.outputs.tags)) }} - - # image: jupyterhub/singleuser - # - - name: Get list of jupyterhub/singleuser tags - id: singleusertags - uses: jupyterhub/action-major-minor-tag-calculator@v3 - with: - githubToken: ${{ secrets.GITHUB_TOKEN }} - prefix: >- - ${{ env.REGISTRY }}jupyterhub/singleuser: - jupyterhub/singleuser: - defaultTag: "${{ env.REGISTRY }}jupyterhub/singleuser:noref" - branchRegex: ^\w[\w-.]*$ - - - name: Build and push jupyterhub/singleuser - uses: docker/build-push-action@v6 - with: - build-args: | - JUPYTERHUB_VERSION=${{ github.ref_type == 'tag' && github.ref_name || format('git:{0}', github.sha) }} - context: singleuser - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ join(fromJson(steps.singleusertags.outputs.tags)) }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 42aa3d29..eba3b9cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -259,24 +259,3 @@ jobs: pytest -k "${{ matrix.subset }}" --maxfail=2 --cov=jupyterhub jupyterhub/tests - uses: codecov/codecov-action@v5 - - docker-build: - runs-on: ubuntu-22.04 - timeout-minutes: 20 - - steps: - - uses: actions/checkout@v4 - - - name: build images - run: | - DOCKER_BUILDKIT=1 docker build -t jupyterhub/jupyterhub . - docker build -t jupyterhub/jupyterhub-onbuild onbuild - docker build -t jupyterhub/singleuser singleuser - - - name: smoke test jupyterhub - run: | - docker run --rm -t jupyterhub/jupyterhub jupyterhub --help - - - name: verify static files - run: | - docker run --rm -t -v $PWD/dockerfiles:/io jupyterhub/jupyterhub python3 /io/test.py diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 286e97b2..00000000 --- a/Dockerfile +++ /dev/null @@ -1,146 +0,0 @@ -# An incomplete base Docker image for running JupyterHub -# -# Add your configuration to create a complete derivative Docker image. -# -# Include your configuration settings by starting with one of two options: -# -# Option 1: -# -# FROM quay.io/jupyterhub/jupyterhub:latest -# -# And put your configuration file jupyterhub_config.py in /srv/jupyterhub/jupyterhub_config.py. -# -# Option 2: -# -# Or you can create your jupyterhub config and database on the host machine, and mount it with: -# -# docker run -v $PWD:/srv/jupyterhub -t quay.io/jupyterhub/jupyterhub -# -# NOTE -# If you base on quay.io/jupyterhub/jupyterhub-onbuild -# your jupyterhub_config.py will be added automatically -# from your docker directory. - -###################################################################### -# This Dockerfile uses multi-stage builds with optimisations to build -# the JupyterHub wheel on the native architecture only -# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/ - -ARG BASE_IMAGE=ubuntu:22.04 - - -###################################################################### -# The JupyterHub wheel is pure Python so can be built for any platform -# on the native architecture (avoiding QEMU emulation) -FROM --platform=${BUILDPLATFORM:-linux/amd64} $BASE_IMAGE AS jupyterhub-builder - -ENV DEBIAN_FRONTEND=noninteractive - -# Don't clear apt cache, and don't combine RUN commands, so that cached layers can -# be reused in other stages - -RUN apt-get update -qq \ - && apt-get install -yqq --no-install-recommends \ - build-essential \ - ca-certificates \ - curl \ - git \ - gnupg \ - locales \ - python3-dev \ - python3-pip \ - python3-pycurl \ - python3-venv \ - && python3 -m pip install --no-cache-dir --upgrade setuptools pip build wheel -# Ubuntu 22.04 comes with Nodejs 12 which is too old for building JupyterHub JS -# It's fine at runtime though (used only by configurable-http-proxy) -ARG NODE_MAJOR=20 -RUN mkdir -p /etc/apt/keyrings \ - && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ - && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \ - && apt-get update \ - && apt-get install -yqq --no-install-recommends \ - nodejs - -WORKDIR /src/jupyterhub -# copy everything except whats in .dockerignore, its a -# compromise between needing to rebuild and maintaining -# what needs to be part of the build -COPY . . - -ARG PIP_CACHE_DIR=/tmp/pip-cache -RUN --mount=type=cache,target=${PIP_CACHE_DIR} \ - python3 -m build --wheel - -# verify installed files -RUN --mount=type=cache,target=${PIP_CACHE_DIR} \ - python3 -m pip install ./dist/*.whl \ - && cd ci \ - && python3 check_installed_data.py - -###################################################################### -# All other wheels required by JupyterHub, some are platform specific -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 - - -###################################################################### -# The final JupyterHub image, platform specific -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 " -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 \ - # clean cache and logs - && rm -rf /var/lib/apt/lists/* /var/log/* /var/tmp/* ~/.npm -# install the wheels we built in the previous stage -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"] diff --git a/demo-image/Dockerfile b/demo-image/Dockerfile deleted file mode 100644 index 6ed786e8..00000000 --- a/demo-image/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# Demo JupyterHub Docker image -# -# This should only be used for demo or testing and not as a base image to build on. -# -# It includes the notebook package and it uses the DummyAuthenticator and the SimpleLocalProcessSpawner. -ARG BASE_IMAGE=quay.io/jupyterhub/jupyterhub-onbuild -FROM ${BASE_IMAGE} - -# Install the notebook package -RUN python3 -m pip install notebook - -# Create a demo user -RUN useradd --create-home demo -RUN chown demo . - -USER demo diff --git a/demo-image/README.md b/demo-image/README.md deleted file mode 100644 index b8ecefb7..00000000 --- a/demo-image/README.md +++ /dev/null @@ -1,26 +0,0 @@ -## Demo Dockerfile - -This is a demo JupyterHub Docker image to help you get a quick overview of what -JupyterHub is and how it works. - -It uses the SimpleLocalProcessSpawner to spawn new user servers and -DummyAuthenticator for authentication. -The DummyAuthenticator allows you to log in with any username & password and the -SimpleLocalProcessSpawner allows starting servers without having to create a -local user for each JupyterHub user. - -### Important! - -This should only be used for demo or testing purposes! -It shouldn't be used as a base image to build on. - -### Try it - -1. `cd` to the root of your jupyterhub repo. - -2. Build the demo image with `docker build -t jupyterhub-demo demo-image`. - -3. Run the demo image with `docker run -d -p 8000:8000 jupyterhub-demo`. - -4. Visit http://localhost:8000 and login with any username and password -5. Happy demo-ing :tada:! diff --git a/demo-image/jupyterhub_config.py b/demo-image/jupyterhub_config.py deleted file mode 100644 index ba87bbe0..00000000 --- a/demo-image/jupyterhub_config.py +++ /dev/null @@ -1,7 +0,0 @@ -# Configuration file for jupyterhub-demo - -c = get_config() # noqa - -# Use DummyAuthenticator and SimpleSpawner -c.JupyterHub.spawner_class = "simple" -c.JupyterHub.authenticator_class = "dummy" diff --git a/dockerfiles/test.py b/dockerfiles/test.py deleted file mode 100644 index 4ce86ebf..00000000 --- a/dockerfiles/test.py +++ /dev/null @@ -1,14 +0,0 @@ -import os - -from jupyterhub._data import DATA_FILES_PATH - -print(f"DATA_FILES_PATH={DATA_FILES_PATH}") - -for sub_path in ( - "templates", - "static/components", - "static/css/style.min.css", - "static/js/admin-react.js", -): - path = os.path.join(DATA_FILES_PATH, sub_path) - assert os.path.exists(path), path diff --git a/onbuild/Dockerfile b/onbuild/Dockerfile deleted file mode 100644 index ec59da35..00000000 --- a/onbuild/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -# JupyterHub Dockerfile that loads your jupyterhub_config.py -# -# Adds ONBUILD step to jupyter/jupyterhub to load your jupyterhub_config.py into the image -# -# Derivative images must have jupyterhub_config.py next to the Dockerfile. - -ARG BASE_IMAGE=quay.io/jupyterhub/jupyterhub:latest -FROM $BASE_IMAGE - -ONBUILD COPY jupyterhub_config.py /srv/jupyterhub/jupyterhub_config.py - -CMD ["jupyterhub", "-f", "/srv/jupyterhub/jupyterhub_config.py"] diff --git a/onbuild/README.md b/onbuild/README.md deleted file mode 100644 index 3d449fee..00000000 --- a/onbuild/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# JupyterHub onbuild image - -If you base a Dockerfile on this image: - - FROM quay.io/jupyterhub/jupyterhub-onbuild:4.0.2 - ... - -then your `jupyterhub_config.py` adjacent to your Dockerfile will be loaded into the image and used by JupyterHub. - -> [!NOTE] -> Inherit from a tag that corresponds to the version of JupyterHub you want to use. -> See our [Quay.io page](https://quay.io/repository/jupyterhub/jupyterhub?tab=tags) for the list of -> available tags. - -> [!WARNING] -> Automatically loading the `jupyterhub_config.py` file was the default behavior of the `quay.io/jupyterhub/jupyterhub` -> image prior to `0.6`. diff --git a/singleuser/Dockerfile b/singleuser/Dockerfile deleted file mode 100644 index 3a479072..00000000 --- a/singleuser/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Build as jupyterhub/singleuser -# Run with the DockerSpawner in JupyterHub - -ARG BASE_IMAGE=quay.io/jupyter/base-notebook -FROM $BASE_IMAGE -MAINTAINER Project Jupyter - -ADD install_jupyterhub /tmp/install_jupyterhub -ARG JUPYTERHUB_VERSION=git:HEAD -# install pinned jupyterhub -RUN python3 /tmp/install_jupyterhub diff --git a/singleuser/README.md b/singleuser/README.md deleted file mode 100644 index c47d6270..00000000 --- a/singleuser/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# jupyterhub/singleuser - -Built from the `jupyter/base-notebook` base image. - -This image contains a single user notebook server for use with -[JupyterHub](https://github.com/jupyterhub/jupyterhub). In particular, it is meant -to be used with the -[DockerSpawner](https://github.com/jupyterhub/dockerspawner/blob/HEAD/dockerspawner/dockerspawner.py) -class to launch user notebook servers within docker containers. - -The only thing this image accomplishes is pinning the jupyterhub version on top of base-notebook. -In most cases, one of the Jupyter [docker-stacks](https://github.com/jupyter/docker-stacks) is a better choice. -You will just have to make sure that you have the right version of JupyterHub installed in your image, -which can usually be accomplished with one line: - -```Dockerfile -FROM jupyter/base-notebook:5ded1de07260 -RUN pip3 install jupyterhub==0.7.2 -``` - -The dockerfile that builds this image exposes `BASE_IMAGE` and `JUPYTERHUB_VERSION` as build args, so you can do: - - docker build -t singleuser \ - --build-arg BASE_IMAGE=jupyter/scipy-notebook \ - --build-arg JUPYTERHUB_VERSION=0.8.0 \ - . - -in this directory to get a new image `singleuser` that is based on `jupyter/scipy-notebook` with JupyterHub 0.8, for example. - -This particular image runs as the `jovyan` user, with home directory at `/home/jovyan`. - -## Note on persistence - -This home directory, `/home/jovyan`, is _not_ persistent by default, -so some configuration is required unless the directory is to be used -with temporary or demonstration JupyterHub deployments. diff --git a/singleuser/install_jupyterhub b/singleuser/install_jupyterhub deleted file mode 100644 index cf20bff2..00000000 --- a/singleuser/install_jupyterhub +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -import os -from subprocess import check_call -import sys - -version = os.environ['JUPYTERHUB_VERSION'] - -pip_install = [ - sys.executable, - '-m', - 'pip', - 'install', - '--no-cache', - '--upgrade', - '--upgrade-strategy', - 'only-if-needed', -] -if version.startswith("git:"): - ref = version.partition(":")[-1] - req = f"https://github.com/jupyterhub/jupyterhub/archive/{ref}.tar.gz" -else: - req = f"jupyterhub=={version}" - -check_call(pip_install + [req])