diff --git a/action.Dockerfile b/action.Dockerfile index ddf84cf..da65b9b 100644 --- a/action.Dockerfile +++ b/action.Dockerfile @@ -1,5 +1,5 @@ FROM icinga/icingaweb2-builder -COPY action.bash Dockerfile get-mods.sh icingaweb2.patch / +COPY action.bash composer.bash Dockerfile get-mods.sh icingaweb2.patch / CMD ["/action.bash"] diff --git a/action.bash b/action.bash index 631f286..0c87879 100755 --- a/action.bash +++ b/action.bash @@ -9,18 +9,9 @@ mkimg () { node /actions/checkout/dist/index.js |grep -vFe ::add-matcher:: git archive --prefix=icingaweb2/ HEAD |tar -x + /get-mods.sh "$1" - - for d in icingaweb2 icingaweb2/modules/*; do - pushd "$d" - - if [ -e composer.json ]; then - composer install --no-dev --ignore-platform-reqs - fi - - popd - done - + /composer.bash patch -d icingaweb2 -p0 < /icingaweb2.patch docker build -f /Dockerfile -t "${TARGET}:$TAG" . diff --git a/build.bash b/build.bash new file mode 100755 index 0000000..15bd021 --- /dev/null +++ b/build.bash @@ -0,0 +1,37 @@ +#!/bin/bash +set -exo pipefail + +IW2SRC="$1" +export MODS_BRANCH="$2" + +if [ -z "$IW2SRC" ]; then + cat <&2 +Usage: ${0} /icingaweb2/source/dir +EOF + + false +fi + +IW2SRC="$(realpath "$IW2SRC")" +BLDCTX="$(realpath "$(dirname "$0")")" + +docker build -f "${BLDCTX}/action-base.Dockerfile" -t icinga/icingaweb2-builder "$BLDCTX" +docker build -f "${BLDCTX}/deps.Dockerfile" -t icinga/icingaweb2-deps "$BLDCTX" + +docker run --rm -i \ + -v "${IW2SRC}:/iw2src:ro" \ + -v "${BLDCTX}:/bldctx:ro" \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -e MODS_BRANCH \ + icinga/icingaweb2-builder bash <