Skip to content

Commit

Permalink
update Docker base image to Debian Bookworm
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joostvanzwieten committed Aug 11, 2023
1 parent 194b57d commit c92bf1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion devtools/container/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
9 changes: 5 additions & 4 deletions devtools/container/build_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit c92bf1c

Please sign in to comment.