apple / apple/swift-container-plugin
containertool should select an appropriate default base image for static and dynamic executables
- Dominant language
- Swift
- Stars
- 390
- Forks
- 26
- Avg merge
- 8m
- Merged PRs (30d)
- 1
Description
`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.
Contributor guide
Research direction
The issue names no files or tests. Start by locating containertool's ELF reader and current default base-image selection, then trace how architecture and linkage are determined. Done means static and dynamic executables select the requested default images, with the automatic-base-image flag behavior and these cases covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, swift
- Domain
- cli, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100