forked from pi-hole/docker-pi-hole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle-deploy.sh
executable file
·51 lines (44 loc) · 1.39 KB
/
circle-deploy.sh
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
#!/usr/bin/env bash
set -ex
# Circle CI Job for merging/deploying all architectures (post-test passing)
. circle-vars.sh
annotate() {
local base=$1
local image=$2
local arch=$3
local annotate_flags="${annotate_map[$arch]}"
$dry docker manifest annotate ${base} ${image} --os linux ${annotate_flags}
}
# Keep in sync with circle-ci job names
declare -A annotate_map=(
["amd64"]="--arch amd64"
["armel"]="--arch arm --variant v6"
["armhf"]="--arch arm --variant v7"
["arm64"]="--arch arm64 --variant v8"
)
# push image when not running a PR
mkdir -p ~/.docker
export DOCKER_CLI_EXPERIMENTAL='enabled'
echo "{}" | jq '.experimental="enabled"' | tee ~/.docker/config.json
docker info
if [[ "$CIRCLE_PR_NUMBER" == "" ]]; then
images=()
echo $DOCKERHUB_PASS | docker login --username=$DOCKERHUB_USER --password-stdin
ls -lat ./ci-workspace/
cd ci-workspace
for arch in *; do
arch_image=$(cat $arch)
docker pull $arch_image
images+=($arch_image)
done
for docker_tag in $MULTIARCH_IMAGE $LATEST_IMAGE; do
docker manifest create $docker_tag ${images[*]}
for arch in *; do
arch_image=$(cat $arch)
docker pull $arch_image
annotate "$docker_tag" "$arch_image" "$arch"
done
docker manifest inspect "$docker_tag"
docker manifest push "$docker_tag"
done;
fi