-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathpush-multiarch.sh
More file actions
42 lines (31 loc) · 1.65 KB
/
push-multiarch.sh
File metadata and controls
42 lines (31 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
set -e
# Pushes a multiarch image for a specific R version and variant. Assumes that the
# source images for both amd64 and arm64 are already available in the remote registry.
#
# - posit/r-base:4.4-noble-amd64, posit/r-base:4.4-noble-arm64 -> posit/r-base:4.4-noble
# - posit/r-base:4.4.3-noble-amd64, posit/r-base:4.4.3-noble-arm64 -> posit/r-base:4.4.3-noble
#
# Usage: BASE_IMAGE=posit/r-base VERSION=4.4 VARIANT=noble ./push-multiarch.sh
# Usage: BASE_IMAGE=posit/r-base VERSION=4.4.3 VARIANT=noble ./push-multiarch.sh
target_image="${BASE_IMAGE}:${VERSION}-${VARIANT}"
source_image_amd64="${BASE_IMAGE}:${VERSION}-${VARIANT}-amd64"
source_image_arm64="${BASE_IMAGE}:${VERSION}-${VARIANT}-arm64"
echo "Pushing multiarch image '$target_image' from: $source_image_amd64 and $source_image_arm64"
docker manifest create "$target_image" \
--amend "$source_image_amd64" \
--amend "$source_image_arm64"
docker manifest push "$target_image"
# Push the patch version alias if applicable, e.g. 4.4-noble.
# This is skipped if pushing a patch version image, e.g. 4.4.3-noble.
if [ -f "${VERSION}/${VARIANT}/version.txt" ]; then
patch_version=$(cat "${VERSION}/${VARIANT}/version.txt")
target_image="${BASE_IMAGE}:${patch_version}-${VARIANT}"
source_image_amd64="${BASE_IMAGE}:${patch_version}-${VARIANT}-amd64"
source_image_arm64="${BASE_IMAGE}:${patch_version}-${VARIANT}-arm64"
echo "Pushing multiarch image '$target_image' from: $source_image_amd64 and $source_image_arm64"
docker manifest create "$target_image" \
--amend "$source_image_amd64" \
--amend "$source_image_arm64"
docker manifest push "$target_image"
fi