#9 resolving
This commit is contained in:
		@@ -1,7 +1,9 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
readonly SUFFIX="$1"
 | 
			
		||||
readonly SKIP_LGSM="$2"
 | 
			
		||||
readonly BUILD_TTT="$(grep -qF -e '--skip-ttt' <<< "$@" && echo false || echo true)"
 | 
			
		||||
readonly PUSH="$(grep -qF -e '--push' <<< "$@" && echo true || echo false)"
 | 
			
		||||
readonly repository="${DOCKER_REPO:-jusito/docker-ttt}"
 | 
			
		||||
 | 
			
		||||
if [ "${DEBUGGING}" = "true" ]; then
 | 
			
		||||
	set -o xtrace
 | 
			
		||||
@@ -13,18 +15,30 @@ set -o errexit
 | 
			
		||||
set -o nounset
 | 
			
		||||
set -o pipefail
 | 
			
		||||
 | 
			
		||||
echo "[testBuild][INFO]build"
 | 
			
		||||
function process() {
 | 
			
		||||
	tag_prefix="$1"
 | 
			
		||||
	target="$2"
 | 
			
		||||
	cache_option="$(grep -qF -e '--no-cache' <<< "$@" && echo "--no-cache" || echo "")"
 | 
			
		||||
 | 
			
		||||
if [ "$SKIP_LGSM" = true ]; then
 | 
			
		||||
	docker rmi "jusito/docker-ttt:lgsm_debian${SUFFIX}" || true
 | 
			
		||||
	docker build --no-cache -t "jusito/docker-ttt:lgsm_debian${SUFFIX}" "lgsm/"
 | 
			
		||||
	docker rmi "$repository:$tag_prefix${SUFFIX}" || true
 | 
			
		||||
	docker build --target "$target" $cache_option -t "$repository:$tag_prefix${SUFFIX}" .
 | 
			
		||||
	if "$PUSH"; then
 | 
			
		||||
		docker push "$repository:$tag_prefix${SUFFIX}"
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
echo "[testBuild][INFO] build"
 | 
			
		||||
 | 
			
		||||
process "lgsm_debian" "lgsm" --no-cache
 | 
			
		||||
process "gmod_debian" "gmod"
 | 
			
		||||
if "$BUILD_TTT"; then
 | 
			
		||||
	process "gmod_ttt_debian" "TTT"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
docker rmi "jusito/docker-ttt:gmod_debian${SUFFIX}" || true
 | 
			
		||||
docker build --no-cache -t "jusito/docker-ttt:gmod_debian${SUFFIX}" "gmod/"
 | 
			
		||||
docker rmi "$repository:latest${SUFFIX}" || true
 | 
			
		||||
docker tag "$repository:gmod_ttt_debian${SUFFIX}" "$repository:latest${SUFFIX}"
 | 
			
		||||
if "$PUSH"; then
 | 
			
		||||
	docker push "$repository:latest${SUFFIX}"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
docker rmi "jusito/docker-ttt:gmod_ttt_debian${SUFFIX}" || true
 | 
			
		||||
docker build --no-cache -t "jusito/docker-ttt:gmod_ttt_debian${SUFFIX}" "TTT/"
 | 
			
		||||
 | 
			
		||||
docker rmi "$DOCKER_REPO:latest${SUFFIX}" || true
 | 
			
		||||
docker tag "$DOCKER_REPO:gmod_ttt_debian${SUFFIX}" "$DOCKER_REPO:latest${SUFFIX}"
 | 
			
		||||
echo "[testBuild][INFO] build done!"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user