|
1 | 1 | #!/usr/bin/env bash
|
2 | 2 |
|
3 |
| -VERSION="${1}" |
4 |
| -[[ -z "${VERSION}" ]] && echo "usage: $0 <version>" >&2 && exit 1 |
| 3 | +TAG="${1}" |
| 4 | +[[ -z "${TAG}" ]] && echo "usage: $0 <version>" >&2 && exit 1 |
5 | 5 |
|
6 |
| -set -ex |
| 6 | +echo "Building & pushing versioned images..." >&2 |
| 7 | +$(dirname $0)/build.sh "${TAG}" push |
7 | 8 |
|
8 |
| -echo "Building & pushing versioned images..." |
9 |
| -$(dirname $0)/build.sh "${VERSION}" push |
| 9 | +# setup |
| 10 | +DEPLOYSTER_HOME=$(cd $(dirname $0)/..; pwd) |
| 11 | +RESOURCES_HOME="${DEPLOYSTER_HOME}/resources" |
| 12 | +TAG_PREFIX="infolinks/deployster" |
10 | 13 |
|
11 |
| -# tag images as VERSION and 'latest', then push them to Docker Hub |
| 14 | +echo "Authenticating to GCR..." >&2 |
12 | 15 | gcloud docker --authorize-only
|
13 |
| -for docker_file in $(find "./resources" -name "Dockerfile"); do |
14 |
| - IMAGE_DIR="${docker_file//\/Dockerfile/}" |
15 |
| - IMAGE_PATH="${IMAGE_DIR//\.\/resources\//}" |
16 |
| - IMAGE_NAME="infolinks/deployster-${IMAGE_PATH//\//-}" |
17 | 16 |
|
18 |
| - docker tag "${IMAGE_NAME}:${VERSION}" "${IMAGE_NAME}:latest" |
19 |
| - docker push "${IMAGE_NAME}:latest" |
| 17 | +# re-tag images with "latest" and push those too |
| 18 | +for dockerfile in $(ls -X ${RESOURCES_HOME}/Dockerfile.*|grep -v ".local"); do |
| 19 | + |
| 20 | + IMAGE_NAME=$(echo "${dockerfile}" | sed "s/.*\/Dockerfile\.\(.\+\)$/\1/g") |
| 21 | + IMAGE_NAME=${IMAGE_NAME//_/-} |
| 22 | + |
| 23 | + echo "Re-tagging Docker image '${TAG_PREFIX}-${IMAGE_NAME}:${TAG}'..." >&2 |
| 24 | + docker tag "${TAG_PREFIX}-${IMAGE_NAME}:${TAG}" "${TAG_PREFIX}-${IMAGE_NAME}:latest" |
| 25 | + docker push "${TAG_PREFIX}-${IMAGE_NAME}:latest" |
20 | 26 | done
|
21 | 27 |
|
22 |
| -docker tag "infolinks/deployster:${VERSION}" "infolinks/deployster:latest" |
23 |
| -docker push "infolinks/deployster:latest" |
| 28 | +# re-tag main deployster image with "latest" and push that too |
| 29 | +echo "Re-tagging main Docker image..." >&2 |
| 30 | +docker tag "${TAG_PREFIX}:${TAG}" "${TAG_PREFIX}:latest" |
| 31 | +docker push "${TAG_PREFIX}:latest" |
0 commit comments