This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·76 lines (61 loc) · 1.98 KB
/
build.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
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
set -e
if [ "$1" == "--no-publish" ]; then
declare -r NOPUBLISH=true
shift 1
elif [ "$1" == "--push-only" ]; then
declare -r PUSHONLY=true
shift 1
fi
declare -r TAG_NAME="mcstreetguy/neos-dockerized"
if [ "$#" -eq 1 ]; then
declare NEOS_VERSION="$1"
if [ "$NEOS_VERSION" == "dev-master" ]; then
declare TAG_VERSION="latest"
else
declare TAG_VERSION="${NEOS_VERSION:1}"
fi
export NEOS_VERSION
export TAG_VERSION
if [ "$NOPUBLISH" ]; then
echo "[INFO] Building '${TAG_NAME}:${TAG_VERSION}' ..." >&2
docker build --tag "${TAG_NAME}:${TAG_VERSION}" --compress --force-rm --pull --build-arg NEOS_VERSION .
elif [ "$PUSHONLY" ]; then
docker push "${TAG_NAME}:${TAG_VERSION}"
else
echo "[INFO] Building '${TAG_NAME}:${TAG_VERSION}' ..." >&2
docker build --tag "${TAG_NAME}:${TAG_VERSION}" --compress --force-rm --pull --build-arg NEOS_VERSION .
docker push "${TAG_NAME}:${TAG_VERSION}"
fi
unset TAG_VERSION
unset NEOS_VERSION
echo "Done." >&2
exit 0
elif [ "$#" -ne 0 ]; then
echo "ERROR! Wrong argument count!" >&2
exit 1
fi
declare -ar NEOS_VERSION_TARGETS=( "^3.0" "^3.1" "^3.2" "^3.3" "^4.0" "^4.1" "^4.2" "^4.3" "dev-master" )
for NEOS_VERSION in "${NEOS_VERSION_TARGETS[@]}"; do
if [ "$NEOS_VERSION" == "dev-master" ]; then
declare TAG_VERSION="latest"
else
declare TAG_VERSION="${NEOS_VERSION:1}"
fi
export NEOS_VERSION
export TAG_VERSION
if [ "$NOPUBLISH" ]; then
echo "[INFO] Building '${TAG_NAME}:${TAG_VERSION}' ..." >&2
docker build --tag "${TAG_NAME}:${TAG_VERSION}" --compress --force-rm --pull --build-arg NEOS_VERSION .
elif [ "$PUSHONLY" ]; then
docker push "${TAG_NAME}:${TAG_VERSION}"
else
echo "[INFO] Building '${TAG_NAME}:${TAG_VERSION}' ..." >&2
docker build --tag "${TAG_NAME}:${TAG_VERSION}" --compress --force-rm --pull --build-arg NEOS_VERSION .
docker push "${TAG_NAME}:${TAG_VERSION}"
fi
unset TAG_VERSION
unset NEOS_VERSION
done
echo "Done." >&2
exit 0