2019-10-15 12:40:02 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-09-27 21:32:03 +02:00
|
|
|
readonly SUFFIX="$1"
|
2021-11-08 19:06:12 +01:00
|
|
|
readonly BUILD_LGSM="$(grep -qF -e '--skip-lgsm' <<< "$@" && echo false || echo true)"
|
|
|
|
readonly PUSH="$(grep -qF -e '--push' <<< "$@" && echo true || echo false)"
|
2021-11-08 18:50:15 +01:00
|
|
|
readonly repository="${DOCKER_REPO:-jusito/docker-ttt}"
|
2020-09-27 21:32:03 +02:00
|
|
|
|
2019-10-15 12:40:02 +02:00
|
|
|
if [ "${DEBUGGING}" = "true" ]; then
|
|
|
|
set -o xtrace
|
|
|
|
else
|
|
|
|
DEBUGGING="false"
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
|
2021-11-08 19:06:12 +01:00
|
|
|
function process() {
|
|
|
|
tag_prefix="$1"
|
|
|
|
subdir="$2"
|
|
|
|
|
|
|
|
docker rmi "$repository:$tag_prefix${SUFFIX}" || true
|
|
|
|
docker build --no-cache -t "$repository:$tag_prefix${SUFFIX}" "$subdir"
|
|
|
|
if "$PUSH"; then
|
|
|
|
docker push "$repository:$tag_prefix${SUFFIX}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-11-08 19:21:56 +01:00
|
|
|
echo "[testBuild][INFO] build"
|
2019-10-15 12:40:02 +02:00
|
|
|
|
2021-11-08 11:28:08 +01:00
|
|
|
if "$BUILD_LGSM"; then
|
2021-11-08 19:06:12 +01:00
|
|
|
process "lgsm_debian" "lgsm/"
|
2020-09-27 21:32:03 +02:00
|
|
|
fi
|
2021-11-08 19:06:12 +01:00
|
|
|
process "gmod_debian" "gmod/"
|
|
|
|
process "gmod_ttt_debian" "TTT/"
|
2019-10-15 12:40:02 +02:00
|
|
|
|
2021-11-08 18:19:51 +01:00
|
|
|
docker rmi "$repository:latest${SUFFIX}" || true
|
|
|
|
docker tag "$repository:gmod_ttt_debian${SUFFIX}" "$repository:latest${SUFFIX}"
|
2021-11-08 19:06:12 +01:00
|
|
|
if "$PUSH"; then
|
|
|
|
docker push "$repository:lgsm_debian${SUFFIX}"
|
2021-11-08 19:21:56 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "[testBuild][INFO] build done!"
|