From c92bf1cfdd941be3b23beb2b209afeabdeebaeb2 Mon Sep 17 00:00:00 2001 From: Joost van Zwieten Date: Fri, 11 Aug 2023 11:13:48 +0200 Subject: [PATCH] update Docker base image to Debian Bookworm This patch updates the Docker base image to Debian Bookworm and accommodates for the following changes. * The APT sources list in the container changed from `/etc/apt/sources.list` to `/etc/apt/sources.list.d/debian.sources`. A `.sources` file is a list of key value pairs including a `Components` key. * The version of the libtbb dependency changed from 2 to 12. * Since Python 3.11 pip complains about installing packages outside of a virtual environment unless the `--break-system-packages` flag is used. --- devtools/container/build.py | 2 +- devtools/container/build_base.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/devtools/container/build.py b/devtools/container/build.py index f575a767a..64160ba75 100644 --- a/devtools/container/build.py +++ b/devtools/container/build.py @@ -66,7 +66,7 @@ container = stack.enter_context(Container.new_from(base, mounts=[Mount(src=wheel, dst=f'/{wheel.name}')])) - container.run('pip', 'install', '--no-cache-dir', f'/{wheel.name}[export_mpl,import_gmsh,matrix_scipy]', env=dict(PYTHONHASHSEED='0')) + container.run('pip', 'install', '--break-system-packages', '--no-cache-dir', f'/{wheel.name}[export_mpl,import_gmsh,matrix_scipy]', env=dict(PYTHONHASHSEED='0')) container.add_label('org.opencontainers.image.url', 'https://github.com/evalf/nutils') container.add_label('org.opencontainers.image.source', 'https://github.com/evalf/nutils') container.add_label('org.opencontainers.image.authors', 'Evalf') diff --git a/devtools/container/build_base.py b/devtools/container/build_base.py index e1a42a81d..176da2d4b 100644 --- a/devtools/container/build_base.py +++ b/devtools/container/build_base.py @@ -14,12 +14,13 @@ log.info(f'building container base image with name `{image_name}`') -with Container.new_from('debian:bullseye', network='host') as container: - container.run('sed', '-i', 's/ main$/ main contrib non-free/', '/etc/apt/sources.list') +with Container.new_from('debian:bookworm', network='host') as container: + container.run('sed', '-i', 's/^Components: .*$/Components: main contrib non-free/', '/etc/apt/sources.list.d/debian.sources') container.run('apt', 'update') - # Package `libtbb2` is required when using Intel MKL with environment + # Package `libtbb12` is required when using Intel MKL with environment # variable `MKL_THREADING_LAYER` set to `TBB`, which is nowadays the default. - container.run('apt', 'install', '-y', '--no-install-recommends', 'python3', 'python3-pip', 'python3-wheel', 'python3-ipython', 'python3-numpy', 'python3-scipy', 'python3-matplotlib', 'python3-pil', 'libmkl-rt', 'libomp-dev', 'libtbb2', 'python3-gmsh', env=dict(DEBIAN_FRONTEND='noninteractive')) + container.run('apt', 'install', '-y', '--no-install-recommends', 'python3', 'python3-pip', 'python3-wheel', 'python3-ipython', 'python3-numpy', 'python3-scipy', 'python3-matplotlib', 'python3-pil', 'libmkl-rt', 'libomp-dev', 'libtbb12', 'python3-gmsh', env=dict(DEBIAN_FRONTEND='noninteractive')) + container.run('apt', 'clean') container.add_label('org.opencontainers.image.url', 'https://github.com/evalf/nutils') container.add_label('org.opencontainers.image.source', 'https://github.com/evalf/nutils') container.add_label('org.opencontainers.image.authors', 'Evalf')