action.bash: build Icinga 2

This commit is contained in:
Alexander A. Klimov 2020-06-19 10:39:00 +02:00
parent 183233801f
commit 4fecaed2dd
4 changed files with 71 additions and 16 deletions

39
action-base.Dockerfile Normal file
View File

@ -0,0 +1,39 @@
FROM buildpack-deps:scm as clone
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
RUN mkdir actions ;\
cd actions ;\
git clone --bare https://github.com/actions/checkout.git ;\
git -C checkout.git archive --prefix=checkout/ v2 |tar -x ;\
git clone --bare https://github.com/actions/cache.git ;\
git -C cache.git archive --prefix=cache/ v2 |tar -x ;\
git clone --bare https://github.com/actions/upload-artifact.git ;\
git -C upload-artifact.git archive --prefix=upload-artifact/ v2 |tar -x ;\
rm -rf *.git
FROM debian:buster-slim
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update ;\
apt-get install --no-install-{recommends,suggests} -y \
apt-transport-https gnupg2 dirmngr ca-certificates ;\
apt-get clean ;\
rm -vrf /var/lib/apt/lists/* ;\
apt-key adv --fetch-keys https://download.docker.com/linux/debian/gpg ;\
apt-get purge -y gnupg2 dirmngr ;\
apt-get autoremove --purge -y
ADD action-base.list /etc/apt/sources.list.d/misc.list
RUN apt-get update ;\
apt-get install --no-install-{recommends,suggests} -y \
bison cmake docker-ce-cli flex g++ \
libboost{,-{context,coroutine,date-time,filesystem,program-options,regex,system,thread}}1.67-dev \
libedit-dev libmariadbclient-dev libpq-dev libssl-dev make nodejs ;\
apt-get install --no-install-{recommends,suggests} -y ccache ;\
apt-get clean ;\
rm -vrf /var/lib/apt/lists/*
COPY --from=clone /actions /actions

2
action-base.list Normal file
View File

@ -0,0 +1,2 @@
deb http://deb.debian.org/debian buster-backports main
deb [arch=amd64] https://download.docker.com/linux/debian buster stable

View File

@ -1,19 +1,4 @@
FROM buildpack-deps:scm as clone
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
RUN mkdir actions ;\
cd actions ;\
git clone --bare https://github.com/actions/checkout.git ;\
git -C checkout.git archive --prefix=checkout/ v2 |tar -x ;\
git clone --bare https://github.com/actions/upload-artifact.git ;\
git -C upload-artifact.git archive --prefix=upload-artifact/ v2 |tar -x ;\
rm -rf *.git
FROM docker
RUN ["apk", "add", "bash", "grep", "nodejs"]
COPY --from=clone /actions /actions
FROM icinga/icinga2-builder
COPY action.bash Dockerfile /

View File

@ -3,11 +3,40 @@ set -exo pipefail
TARGET=icinga/icinga2
cache () {
INPUT_KEY=docker-image/ccache INPUT_PATH=ccache \
STATE_CACHE_KEY=1 STATE_CACHE_RESULT=2 \
node "/actions/cache/dist/${1}/index.js"
}
mkimg () {
test -n "$TAG"
node /actions/checkout/dist/index.js |grep -vFe ::add-matcher::
cache restore
export PATH="/usr/lib/ccache:$PATH"
mkdir -p ccache
ln -vs "$(pwd)/ccache" ~/.ccache
mkdir icinga2-bin
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_LOCALSTATEDIR=/var -DICINGA2_RUNDIR=/run \
-DICINGA2_SYSCONFIGFILE=/etc/sysconfig/icinga2 -DICINGA2_WITH_{COMPAT,LIVESTATUS}=OFF ..
make
make test
make install "DESTDIR=$(pwd)/../icinga2-bin"
cd ..
cache save
docker build -f /Dockerfile -t "${TARGET}:$TAG" .
STATE_isPost=1 node /actions/checkout/dist/index.js
docker save "${TARGET}:$TAG" |gzip >docker-save.tgz