From 9fc7b03cad21702ede81f17ed4fd87b10a661403 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 3 Jul 2020 15:56:22 +0200 Subject: [PATCH 1/2] action.bash: outsource composer install into composer.bash --- action.Dockerfile | 2 +- action.bash | 13 ++----------- composer.bash | 12 ++++++++++++ 3 files changed, 15 insertions(+), 12 deletions(-) create mode 100755 composer.bash 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/composer.bash b/composer.bash new file mode 100755 index 0000000..06382b6 --- /dev/null +++ b/composer.bash @@ -0,0 +1,12 @@ +#!/bin/bash +set -exo pipefail + +for d in icingaweb2 icingaweb2/modules/*; do + pushd "$d" + + if [ -e composer.json ]; then + composer install --no-dev --ignore-platform-reqs + fi + + popd +done From 4c126eeaa0a4eb4cb4170b18fe3a243cea9db12a Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 3 Jul 2020 16:11:43 +0200 Subject: [PATCH 2/2] Add build.bash --- build.bash | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 build.bash 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 <