-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmulti-arch.sh
More file actions
executable file
·47 lines (41 loc) · 1.17 KB
/
multi-arch.sh
File metadata and controls
executable file
·47 lines (41 loc) · 1.17 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
43
44
45
46
47
#!/bin/bash
REGISTRY=${REGISTRY:-danielxlee}
# If have multi images, use empty split them, like: "curl:latest yq:latest"
IMAGES=${IMAGES:-}
function build_multi() {
echo ">> 2: Create manifest list against a specified registry"
for IMAGE in $IMAGES; do
cat > registry.yaml <<EOF
image: ${REGISTRY}/${IMAGE}
manifests:
-
image: ${REGISTRY}/${IMAGE//:/-ppc64le:}
platform:
architecture: ppc64le
os: linux
-
image: ${REGISTRY}/${IMAGE//:/-amd64:}
platform:
architecture: amd64
os: linux
-
image: ${REGISTRY}/${IMAGE//:/-s390x:}
platform:
architecture: s390x
os: linux
EOF
./manifest-tool push from-spec registry.yaml
done
}
function manifest_tool() {
ARCH=$(uname -m | sed 's/x86_64/amd64/g')
if [[ ! -f manifest-tool ]]; then
echo ">> 1: Install manifest-tool"
wget https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-${ARCH} -O manifest-tool
chmod +x manifest-tool
fi
}
#------------------------ Main ------------------------#
[[ "X$IMAGES" == "X" ]] && echo "Missing images list, export IMAGES='a:1.0 b:2.0' before run script." && exit 0
manifest_tool
build_multi