-
Notifications
You must be signed in to change notification settings - Fork 533
/
docker_manifest.sh
executable file
·45 lines (38 loc) · 1.44 KB
/
docker_manifest.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
#!/bin/bash -x
# Creates and pushes manifests for flavors
#
# ./docker_manifest.sh FLAVOR TAG1 ....
#
# Docker password is in a file /tmp/docker.pass
# because this script uses -x for build transparency
# but we don't want to leak passwords
set -e
FLAVOR="$1"
shift
AMENDS=""
for TAG in "$@"; do
AMENDS="$AMENDS --amend $DOCKER_ORG/openresty:$TAG"
done
export DOCKER_CLI_EXPERIMENTAL=enabled
cat /tmp/docker.pass | docker login -u="$DOCKER_USERNAME" --password-stdin
if [[ "$TRAVIS_BRANCH" == "master" ]] ; then
docker manifest create $DOCKER_ORG/openresty:$FLAVOR $AMENDS &&
docker manifest push $DOCKER_ORG/openresty:$FLAVOR ;
fi
if [[ "$TRAVIS_TAG" ]] ; then
TRAVIS_TAG_BASE=$(echo -n "$TRAVIS_TAG" | sed 's/-[0-9]$//g') ;
if [[ ( "$TRAVIS_TAG_BASE" ) && ( "$TRAVIS_TAG_BASE" != "$TRAVIS_TAG" ) ]] ; then
AMENDS_TAG_BASE=""
for TAG in "$@"; do
AMENDS_TAG_BASE="$AMENDS_TAG_BASE --amend $DOCKER_ORG/openresty:$TRAVIS_TAG_BASE-$TAG"
done
docker manifest create $DOCKER_ORG/openresty:$TRAVIS_TAG_BASE-$FLAVOR $AMENDS_TAG_BASE &&
docker manifest push $DOCKER_ORG/openresty:$TRAVIS_TAG_BASE-$FLAVOR ;
fi ;
AMENDS_TAG=""
for TAG in "$@"; do
AMENDS_TAG="$AMENDS_TAG --amend $DOCKER_ORG/openresty:$TRAVIS_TAG-$TAG"
done
docker manifest create $DOCKER_ORG/openresty:$TRAVIS_TAG-$FLAVOR $AMENDS_TAG &&
docker manifest push $DOCKER_ORG/openresty:$TRAVIS_TAG-$FLAVOR ;
fi