File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,13 +41,11 @@ install_arm64_from_source() {
4141 local build_dir=" /tmp/apptainer-build"
4242 local source_tarball=" /tmp/apptainer-${APPTAINER_VERSION} .tar.gz"
4343 local source_url=" https://github.com/apptainer/apptainer/releases/download/v${APPTAINER_VERSION} /apptainer-${APPTAINER_VERSION} .tar.gz"
44+ # curl, git, and wget are installed by docker/Dockerfile and must remain in the final image.
4445 local build_packages=(
4546 autoconf
4647 automake
47- build-essential
48- curl
4948 dh-apparmor
50- git
5149 libfuse3-dev
5250 liblzo2-dev
5351 liblz4-dev
@@ -57,10 +55,10 @@ install_arm64_from_source() {
5755 libtool
5856 libzstd-dev
5957 pkg-config
60- wget
6158 zlib1g-dev
6259 )
6360 local runtime_packages=(
61+ build-essential
6462 ca-certificates
6563 cryptsetup
6664 fakeroot
@@ -77,6 +75,13 @@ install_arm64_from_source() {
7775 uidmap
7876 zlib1g
7977 )
78+ local new_build_packages=()
79+
80+ for package in " ${build_packages[@]} " ; do
81+ if ! dpkg-query -W -f=' ${db:Status-Abbrev}' " ${package} " 2> /dev/null | grep -q ' ^ii ' ; then
82+ new_build_packages+=(" ${package} " )
83+ fi
84+ done
8085
8186 apt-get update
8287 apt-get install -y --no-install-recommends " ${runtime_packages[@]} " " ${build_packages[@]} "
@@ -100,7 +105,9 @@ install_arm64_from_source() {
100105 rm -rf " ${build_dir} "
101106
102107 apt-get install -y --no-install-recommends " ${runtime_packages[@]} "
103- apt-get purge -y --auto-remove " ${build_packages[@]} "
108+ if (( ${# new_build_packages[@]} > 0 )) ; then
109+ apt-get purge -y --auto-remove " ${new_build_packages[@]} "
110+ fi
104111 rm -rf /usr/local/go /root/go /root/.cache/go-build
105112}
106113
You can’t perform that action at this time.
0 commit comments