fix docker ci

This commit is contained in:
Lucas Briese 2021-11-08 19:06:12 +01:00
parent 5264cfe4c0
commit 77383c4b7d
2 changed files with 20 additions and 14 deletions

View File

@ -10,8 +10,4 @@ fi
cd .. cd ..
bash test/testBuild.sh "$imageSuffix" bash test/testBuild.sh "$imageSuffix" --push
docker push "$DOCKER_REPO:gmod_debian${imageSuffix}"
docker push "$DOCKER_REPO:gmod_ttt_debian${imageSuffix}"
docker push "$DOCKER_REPO:latest${imageSuffix}"

View File

@ -1,7 +1,8 @@
#!/bin/bash #!/bin/bash
readonly SUFFIX="$1" readonly SUFFIX="$1"
readonly BUILD_LGSM="$(grep -qF '--skip-lgsm' <<< "$@" && echo false || echo true)" readonly BUILD_LGSM="$(grep -qF -e '--skip-lgsm' <<< "$@" && echo false || echo true)"
readonly PUSH="$(grep -qF -e '--push' <<< "$@" && echo true || echo false)"
readonly repository="${DOCKER_REPO:-jusito/docker-ttt}" readonly repository="${DOCKER_REPO:-jusito/docker-ttt}"
if [ "${DEBUGGING}" = "true" ]; then if [ "${DEBUGGING}" = "true" ]; then
@ -14,18 +15,27 @@ set -o errexit
set -o nounset set -o nounset
set -o pipefail set -o pipefail
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
}
echo "[testBuild][INFO]build" echo "[testBuild][INFO]build"
if "$BUILD_LGSM"; then if "$BUILD_LGSM"; then
docker rmi "$repository:lgsm_debian${SUFFIX}" || true process "lgsm_debian" "lgsm/"
docker build --no-cache -t "$repository:lgsm_debian${SUFFIX}" "lgsm/"
fi fi
process "gmod_debian" "gmod/"
docker rmi "$repository:gmod_debian${SUFFIX}" || true process "gmod_ttt_debian" "TTT/"
docker build --no-cache -t "$repository:gmod_debian${SUFFIX}" "gmod/"
docker rmi "$repository:gmod_ttt_debian${SUFFIX}" || true
docker build --no-cache -t "$repository:gmod_ttt_debian${SUFFIX}" "TTT/"
docker rmi "$repository:latest${SUFFIX}" || true docker rmi "$repository:latest${SUFFIX}" || true
docker tag "$repository:gmod_ttt_debian${SUFFIX}" "$repository:latest${SUFFIX}" docker tag "$repository:gmod_ttt_debian${SUFFIX}" "$repository:latest${SUFFIX}"
if "$PUSH"; then
docker push "$repository:lgsm_debian${SUFFIX}"
fi