blob: b27d5ab22f7297a437f787d2e7ac019b129ff1dd (
plain)
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
48
49
50
51
52
53
54
55
|
#!/bin/bash
if [[ -z "$TARGET" ]]; then
echo "TARGET environment variable must be set e.g. TARGET=stage3-amd64."
exit 1
fi
# Split the TARGET variable into three elements separated by hyphens
IFS=- read -r NAME ARCH SUFFIX <<< "${TARGET}"
# Push built images
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
docker push "${ORG}/${NAME}"
if [[ "${TARGET}" != stage* ]]; then
echo "Done! No manifests to push for TARGET=${TARGET}."
exit 0
fi
VERSION=${VERSION:-$(date -u +%Y%m%d)}
declare -A MANIFEST_ARCHES=(
[stage3:latest]="amd64;arm64;armv5tel;armv6j_hardfp;armv7a_hardfp;ppc64le;s390x;x86"
[stage3:hardened]="amd64;x86"
[stage3:hardened-nomultilib]="amd64"
[stage3:musl-hardened]="amd64"
[stage3:musl-vanilla]="amd64;x86"
[stage3:nomultilib]="amd64"
[stage3:systemd]="amd64;arm64;x86"
[stage3:uclibc-hardened]="amd64;x86"
[stage3:uclibc-vanilla]="amd64;x86"
)
# Latest manifests
MANIFEST="${NAME}:${SUFFIX:-latest}"
IFS=';' read -ra ARCHES <<< "${MANIFEST_ARCHES[${MANIFEST}]}"
TAGS=()
for ARCH in "${ARCHES[@]}"; do
TAGS+=("${ORG}/${NAME}:${ARCH}${SUFFIX:+-${SUFFIX}}")
done
docker manifest create "${ORG}/${MANIFEST}" "${TAGS[@]}"
docker manifest push "${ORG}/${MANIFEST}"
# Dated manifests
MANIFEST="${NAME}:${SUFFIX:+${SUFFIX}-}${VERSION}"
TAGS=()
for ARCH in "${ARCHES[@]}"; do
TAGS+=("${ORG}/${NAME}:${ARCH}${SUFFIX:+-${SUFFIX}}-${VERSION}")
done
docker manifest create "${ORG}/${MANIFEST}" "${TAGS[@]}"
docker manifest push "${ORG}/${MANIFEST}"
|