@@ -153,12 +153,75 @@ function update_node_version() {
153153 fi
154154 else
155155 sed -Ei -e " s/(alpine:)0.0/\\ 1${alpine_version} /" " ${dockerfile} -tmp"
156- sed -Ei -e " s/CHECKSUM=CHECKSUM_x64/CHECKSUM=\" ${checksum} \" /" " ${dockerfile} -tmp"
156+
157+ alpine_arch=' '
158+ local -a arches
159+ arches=$( jq -r " .\" ${version} \" .variants.\" alpine${alpine_version} \" | @sh" " versions.json" )
160+ if [[ " ${arches[0]} " == * " amd64" * ]]; then
161+ alpine_arch+=' x86_64) ARCH=' " '" ' x64' " '" ' CHECKSUM="' ${checksum} ' " OPENSSL_ARCH=linux-x86_64;; \\\n '
162+ fi
163+ if [[ " ${arches[0]} " == * " arm64v8" * ]]; then
164+ alpine_arch+=' aarch64) OPENSSL_ARCH=linux-aarch64;; \\\n '
165+ fi
166+ if [[ " ${arches[0]} " == * " arm32" * ]]; then
167+ alpine_arch+=' arm*) OPENSSL_ARCH=linux-armv4;; \\\n '
168+ fi
169+ if [[ " ${arches[0]} " == * " ppc64le" * ]]; then
170+ alpine_arch+=' ppc64le) OPENSSL_ARCH=linux-ppc64le;; \\\n '
171+ fi
172+ if [[ " ${arches[0]} " == * " s390x" * ]]; then
173+ alpine_arch+=' s390x) OPENSSL_ARCH=linux-s390x;; \\\n '
174+ fi
175+ # shellcheck disable=SC1003
176+ alpine_arch+=' *) ;; \\'
177+ sed -Ei -e " s/\"\\ $\{ALPINE_ARCH\[@\]\}\" /${alpine_arch} /" " ${dockerfile} -tmp"
157178 fi
158179 elif is_debian " ${variant} " ; then
159180 sed -Ei -e " s/(buildpack-deps:)name/\\ 1${variant} /" " ${dockerfile} -tmp"
181+ deb_arch=' '
182+ local -a arches
183+ arches=$( jq -r " .\" ${version} \" .variants.\" ${variant} \" | @sh" " versions.json" )
184+ if [[ " ${arches[0]} " == * " amd64" * ]]; then
185+ deb_arch+=' amd64) ARCH=' " '" ' x64' " '" ' ;; \\\n '
186+ fi
187+ if [[ " ${arches[0]} " == * " ppc64le" * ]]; then
188+ deb_arch+=' ppc64el) ARCH=' " '" ' ppc64le' " '" ' ;; \\\n '
189+ fi
190+ if [[ " ${arches[0]} " == * " s390x" * ]]; then
191+ deb_arch+=' s390x) ARCH=' " '" ' s390x' " '" ' ;; \\\n '
192+ fi
193+ if [[ " ${arches[0]} " == * " arm64v8" * ]]; then
194+ deb_arch+=' arm64) ARCH=' " '" ' arm64' " '" ' ;; \\\n '
195+ fi
196+ if [[ " ${arches[0]} " == * " arm32v7" * ]]; then
197+ deb_arch+=' armhf) ARCH=' " '" ' armv7l' " '" ' ;; \\\n '
198+ fi
199+ # shellcheck disable=SC1003
200+ deb_arch+=' *) echo "unsupported architecture"; exit 1 ;; \\'
201+ sed -Ei -e " s/\"\\ $\{DEB_ARCH\[@\]\}\" /${deb_arch} /" " ${dockerfile} -tmp"
160202 elif is_debian_slim " ${variant} " ; then
161203 sed -Ei -e " s/(debian:)name-slim/\\ 1${variant} /" " ${dockerfile} -tmp"
204+ deb_arch=' '
205+ local -a arches
206+ arches=$( jq -r " .\" ${version} \" .variants.\" ${variant} \" | @sh" " versions.json" )
207+ if [[ " ${arches[0]} " == * " amd64" * ]]; then
208+ deb_arch+=' amd64) ARCH=' " '" ' x64' " '" ' OPENSSL_ARCH=' " '" ' linux-x86_64' " '" ' ;; \\\n '
209+ fi
210+ if [[ " ${arches[0]} " == * " ppc64le" * ]]; then
211+ deb_arch+=' ppc64el) ARCH=' " '" ' ppc64le' " '" ' OPENSSL_ARCH=' " '" ' linux-ppc64le' " '" ' ;; \\\n '
212+ fi
213+ if [[ " ${arches[0]} " == * " s390x" * ]]; then
214+ deb_arch+=' s390x) ARCH=' " '" ' s390x' " '" ' OPENSSL_ARCH=' " '" ' linux*-s390x' " '" ' ;; \\\n '
215+ fi
216+ if [[ " ${arches[0]} " == * " arm64v8" * ]]; then
217+ deb_arch+=' arm64) ARCH=' " '" ' arm64' " '" ' OPENSSL_ARCH=' " '" ' linux-aarch64' " '" ' ;; \\\n '
218+ fi
219+ if [[ " ${arches[0]} " == * " arm32v7" * ]]; then
220+ deb_arch+=' armhf) ARCH=' " '" ' armv7l' " '" ' OPENSSL_ARCH=' " '" ' linux-armv4' " '" ' ;; \\\n '
221+ fi
222+ # shellcheck disable=SC1003
223+ deb_arch+=' *) echo "unsupported architecture"; exit 1 ;; \\'
224+ sed -Ei -e " s/\"\\ $\{DEB_ARCH\[@\]\}\" /${deb_arch} /" " ${dockerfile} -tmp"
162225 fi
163226
164227 # Strip out Yarn v1 from Node 26+ images https://github.com/nodejs/docker-node/issues/2407
0 commit comments