-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.script.sh
executable file
·65 lines (48 loc) · 1.46 KB
/
.travis.script.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash -xe
DOCKER_ORG="clomps"
DOCKER_IMAGE="example-webserver"
DOCKER_TAG="latest"
MANIFEST=${DOCKER_ORG}/${DOCKER_IMAGE}:${DOCKER_TAG}
platforms=(arm arm64 amd64)
manifest_args=(${MANIFEST})
#
# remove any previous builds
#
rm -Rf target
mkdir target
#
# generate image for each platform
#
for platform in "${platforms[@]}"; do
docker run -it --rm --privileged -v ${PWD}:/tmp/work --entrypoint buildctl-daemonless.sh moby/buildkit:master \
build \
--frontend dockerfile.v0 \
--opt platform=linux/${platform} \
--opt filename=./Dockerfile \
--output type=docker,name=${MANIFEST}-${platform},dest=/tmp/work/target/${DOCKER_IMAGE}-${platform}.docker.tar \
--local context=/tmp/work \
--local dockerfile=/tmp/work \
--progress plain
manifest_args+=("${MANIFEST}-${platform}")
done
#
# login to docker hub
#
unset HISTFILE
echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin
#
# push all generated images
#
for platform in "${platforms[@]}"; do
docker load --input ./target/${DOCKER_IMAGE}-${platform}.docker.tar
docker push ${MANIFEST}-${platform}
done
#
# create manifest, update, and push
#
export DOCKER_CLI_EXPERIMENTAL=enabled
docker manifest create "${manifest_args[@]}"
for platform in "${platforms[@]}"; do
docker manifest annotate ${MANIFEST} ${MANIFEST}-${platform} --arch ${platform}
done
docker manifest push --purge ${MANIFEST}