Skip to content

containertool should select an appropriate default base image for static and dynamic executables #131

@euanh

Description

@euanh

containertool reads the architecture from the executable's ELF header and uses it to choose the correct base image manifest from a multi-arch base image (e.g. it will choose an aarch64 base image for an aarch64 executable).

It could be helpful to expand this to choose different default base images for statically- and dynamically-linked executables. The ELF reader would need to be improved to read the necessary information.

  • if the executable is statically linked, use DEFAULT_STATIC_BASE_IMAGE, which could be a distroless image.
  • if the executable is dynamically linked, use DEFAULT_DYNAMIC_BASE_IMAGE, which could be the current default of swift:slim

Going further, dynamic executables linked with --static-swift-stdlib could use a third default base image which provides the usual Linux dynamic libraries but does not include the Swift runtime, as this is not necessary.

This feature could be guarded behind a --automatic-base-image flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions