mirror of
https://github.com/Icinga/docker-icingaweb2.git
synced 2025-10-26 05:20:58 +01:00
Rationale: for security reasons include the latest deps, at least in release images. Therefore include them everywhere, so the CI warns early enough.
52 lines
1.0 KiB
Bash
Executable File
52 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Icinga Web 2 Docker image | (c) 2020 Icinga GmbH | GPLv2+
|
|
set -exo pipefail
|
|
|
|
TARGET=icinga/icingaweb2
|
|
|
|
mkimg () {
|
|
test -n "$TAG"
|
|
|
|
node /actions/checkout/dist/index.js |grep -vFe ::add-matcher::
|
|
|
|
git archive --prefix=icingaweb2/ HEAD |tar -x
|
|
|
|
/get-mods.sh "$1"
|
|
/composer.bash
|
|
patch -d icingaweb2 -p0 < /icingaweb2.patch
|
|
|
|
cp -r /entrypoint .
|
|
docker build -f /Dockerfile -t "${TARGET}:$TAG" .
|
|
|
|
STATE_isPost=1 node /actions/checkout/dist/index.js
|
|
}
|
|
|
|
push () {
|
|
test -n "$TAG"
|
|
|
|
if [ "$(tr -d '\n' <<<"$DOCKER_HUB_PASSWORD" |wc -c)" -gt 0 ]; then
|
|
docker login -u icingaadmin --password-stdin <<<"$DOCKER_HUB_PASSWORD"
|
|
docker push "${TARGET}:$TAG"
|
|
docker logout
|
|
fi
|
|
}
|
|
|
|
re_docker_tag="^refs/(heads|tags)/([^/]+|[a-z]+/(.*))$"
|
|
|
|
case "$GITHUB_EVENT_NAME" in
|
|
workflow_dispatch|schedule|release)
|
|
[[ "$GITHUB_REF" =~ $re_docker_tag ]]
|
|
if [ -n "${BASH_REMATCH[3]}" ]; then
|
|
TAG="${BASH_REMATCH[3]}"
|
|
else
|
|
TAG="${BASH_REMATCH[2]}"
|
|
fi
|
|
mkimg
|
|
push
|
|
;;
|
|
*)
|
|
echo "Unknown event: $GITHUB_EVENT_NAME" >&2
|
|
false
|
|
;;
|
|
esac
|