Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking: hub image ubuntu->debian, py38->py39, build-essential removed, --build-arg PIP_OVERRIDES=... removed, images/hub/dependencies removed #2733

Merged

Conversation

consideRatio
Copy link
Member

@consideRatio consideRatio commented May 29, 2022

I've trialed a switch from ubuntu:20.04 to python:3.9-slim-bullseye and think this is a breaking change we should do. Closes #2731. Some of the changes in this PR are changes that could be done with ubuntu:20.04 as well.

Image size

Using dive:

  • Old image: 623 MB
  • New image: 437 MB (70% of old image)

About removed apt packages

  • libpq-dev doesn't have to be installed any more as there is a pip wheel for aarch64 now making it not needed.
  • build-essential isn't needed, but removing it makes people who install packages later that require gcc etc need to install it.
  • python3* is removed as the base image provides python for us.

About pycurl apt package dependencies

It seems that we can get openssl as a backend for pycurl (introduced in #1185) by referencing libcurl4 without needing to install libssl-dev and libcurl4-openssl-dev.

If I test to run python -c "import pycurl; print(pycurl.version_info())" in the 1.2.0 image and compare with the output from this new Dockerfile we see this.

# pycurl.version_info() from this Dockerfile
(7, '7.74.0', 477696, 'x86_64-pc-linux-gnu', 29345693, 'OpenSSL/1.1.1n', 0, '1.2.11', ('dict', 'file', 'ftp', 'ftps', 'gopher', 'http', 'https', 'imap', 'imaps', 'ldap', 'ldaps', 'mqtt', 'pop3', 'pop3s', 'rtmp', 'rtsp', 'scp', 'sftp', 'smb', 'smbs', 'smtp', 'smtps', 'telnet', 'tftp'), None, 0, '2.3.0')
# pycurl.version_info() from the hub image version 1.2.0
(5, '7.68.0', 476160, 'x86_64-pc-linux-gnu', 12568477, 'OpenSSL/1.1.1f', 0, '1.2.11', ('dict', 'file', 'ftp', 'ftps', 'gopher', 'http', 'https', 'imap', 'imaps', 'ldap', 'ldaps', 'pop3', 'pop3s', 'rtmp', 'rtsp', 'scp', 'sftp', 'smb', 'smbs', 'smtp', 'smtps', 'telnet', 'tftp'), None, 0, '2.2.0')

About removed --build-arg PIP_OVERRIDES

This was introduced by me in #1948. I think it should be removed now. We have requirements.txt to allow anyone pin whatever version if the repo is cloned the repo, and at worst someone would have to do a sed replace operation to the in the requirements.txt file or append a line if they have automation to make their own build of the hub image.

Above removed images/hub/dependencies script

This script was removed for binderhub in jupyterhub/binderhub#1433, but not for z2jh because of how we passed --build-arg with PIP_OVERRIDES something we stopped with.

The script is no longer needed, but instead we can simply do this and we are done. This script works both locally and in a GitHub CI environment as well, which makes us able to use automation to update this.

cd images/hub
docker run --rm \
    --env=CUSTOM_COMPILE_COMMAND="see README.md" \
    --volume=$PWD:/io \
    --workdir=/io \
    --user=root \
    python:3.9-bullseye \
    sh -c 'pip install pip-tools==6.* && pip-compile --upgrade'

@consideRatio consideRatio marked this pull request as draft May 29, 2022 09:32
@consideRatio consideRatio force-pushed the pr/test-python-3.9-slim-bullseye-image branch from 3405428 to 9b5135b Compare May 29, 2022 12:08
@consideRatio consideRatio changed the title breaking, maint: trial python39-slim-bullseye as hub base image breaking, maint: python39-slim-bullseye as hub base image May 29, 2022
@consideRatio consideRatio force-pushed the pr/test-python-3.9-slim-bullseye-image branch from 07ac375 to 5193268 Compare May 29, 2022 14:41
@consideRatio consideRatio force-pushed the pr/test-python-3.9-slim-bullseye-image branch from 5193268 to fa81c67 Compare May 29, 2022 15:16
@consideRatio consideRatio changed the title breaking, maint: python39-slim-bullseye as hub base image breaking: hub image ubuntu->debian, build-essential removed, --build-arg PIP_OVERRIDES=... removed, images/hub/dependencies removed May 29, 2022
@consideRatio consideRatio requested review from minrk, manics and yuvipanda and removed request for minrk and manics May 29, 2022 15:23
@consideRatio consideRatio marked this pull request as ready for review May 29, 2022 15:41
Copy link
Member

@minrk minrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@yuvipanda yuvipanda merged commit eec528d into jupyterhub:main May 31, 2022
@yuvipanda
Copy link
Collaborator

yay! I also appreciate the addition of tini.

consideRatio pushed a commit to jupyterhub/helm-chart that referenced this pull request May 31, 2022
jupyterhub/zero-to-jupyterhub-k8s#2733 Merge pull request #2733 from consideRatio/pr/test-python-3.9-slim-bullseye-image
@consideRatio consideRatio changed the title breaking: hub image ubuntu->debian, build-essential removed, --build-arg PIP_OVERRIDES=... removed, images/hub/dependencies removed breaking: hub image ubuntu->debian, py38->py39, build-essential removed, --build-arg PIP_OVERRIDES=... removed, images/hub/dependencies removed Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hub.image currenlty based on ubuntu:20.04 - switch to python:3.9-slim-bullseye (Debian 11)?
3 participants