moved to multi multi stage build
docker ci executing hook with always pull before build. Therefore e.g. first image is created but right after overwritten by previous image.
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
readonly SUFFIX="$1"
|
||||
readonly BUILD_LGSM="$(grep -qF -e '--skip-lgsm' <<< "$@" && echo false || echo true)"
|
||||
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}"
|
||||
|
||||
@ -18,9 +18,10 @@ set -o pipefail
|
||||
function process() {
|
||||
tag_prefix="$1"
|
||||
subdir="$2"
|
||||
cache_option="$(grep -qF -e '--no-cache' <<< "$@" && echo "--no-cache" || echo "")"
|
||||
|
||||
docker rmi "$repository:$tag_prefix${SUFFIX}" || true
|
||||
docker build --no-cache -t "$repository:$tag_prefix${SUFFIX}" "$subdir"
|
||||
docker build --target "$subdir" $cache_option -t "$repository:$tag_prefix${SUFFIX}" "$subdir/"
|
||||
if "$PUSH"; then
|
||||
docker push "$repository:$tag_prefix${SUFFIX}"
|
||||
fi
|
||||
@ -28,16 +29,16 @@ function process() {
|
||||
|
||||
echo "[testBuild][INFO] build"
|
||||
|
||||
if "$BUILD_LGSM"; then
|
||||
process "lgsm_debian" "lgsm/"
|
||||
process "lgsm_debian" "lgsm" --no-cache
|
||||
process "gmod_debian" "gmod"
|
||||
if "$BUILD_TTT"; then
|
||||
process "gmod_ttt_debian" "TTT"
|
||||
fi
|
||||
process "gmod_debian" "gmod/"
|
||||
process "gmod_ttt_debian" "TTT/"
|
||||
|
||||
docker rmi "$repository:latest${SUFFIX}" || true
|
||||
docker tag "$repository:gmod_ttt_debian${SUFFIX}" "$repository:latest${SUFFIX}"
|
||||
if "$PUSH"; then
|
||||
docker push "$repository:lgsm_debian${SUFFIX}"
|
||||
docker push "$repository:latest${SUFFIX}"
|
||||
fi
|
||||
|
||||
echo "[testBuild][INFO] build done!"
|
||||
|
Reference in New Issue
Block a user