forked from WildMeOrg/scout
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.sh
More file actions
36 lines (31 loc) · 824 Bytes
/
publish.sh
File metadata and controls
36 lines (31 loc) · 824 Bytes
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
#!/usr/bin/env bash
set -e
usage () {
echo "Usage: $0 [-t <tag>] [-r <registry-url>] [<image> ...]";
}
# Parse commandline options
while getopts ":t:r:" option; do
case ${option} in
t ) TAG=${OPTARG};;
r ) REGISTRY=${OPTARG};;
\? ) usage; exit 1;;
esac
done
shift $((OPTIND - 1))
# Assign variables
TAG=${TAG:-latest}
REGISTRY=${REGISTRY:-}
IMAGES=${@:-scout}
# Set the image prefix
if [ -n "$REGISTRY" ]; then
IMG_PREFIX="${REGISTRY}/"
else
IMG_PREFIX="wildme/"
fi
# Tag built images from `build.sh`, which tags as `latest`
for IMG in $IMAGES; do
echo "Tagging scout/${IMG}:latest --> ${IMG_PREFIX}${IMG}:${TAG}"
docker tag wildme/${IMG}:latest ${IMG_PREFIX}${IMG}:${TAG}
echo "Pushing ${IMG_PREFIX}${IMG}:${TAG}"
docker push ${IMG_PREFIX}${IMG}:${TAG}
done