mirror of
https://github.com/Icinga/docker-icinga2.git
synced 2025-11-08 10:51:03 +01:00
action.bash: build Icinga 2
This commit is contained in:
parent
183233801f
commit
4fecaed2dd
39
action-base.Dockerfile
Normal file
39
action-base.Dockerfile
Normal 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
2
action-base.list
Normal 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
|
||||||
@ -1,19 +1,4 @@
|
|||||||
FROM buildpack-deps:scm as clone
|
FROM icinga/icinga2-builder
|
||||||
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
|
|
||||||
|
|
||||||
COPY action.bash Dockerfile /
|
COPY action.bash Dockerfile /
|
||||||
|
|
||||||
|
|||||||
29
action.bash
29
action.bash
@ -3,11 +3,40 @@ set -exo pipefail
|
|||||||
|
|
||||||
TARGET=icinga/icinga2
|
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 () {
|
mkimg () {
|
||||||
test -n "$TAG"
|
test -n "$TAG"
|
||||||
|
|
||||||
node /actions/checkout/dist/index.js |grep -vFe ::add-matcher::
|
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" .
|
docker build -f /Dockerfile -t "${TARGET}:$TAG" .
|
||||||
|
|
||||||
STATE_isPost=1 node /actions/checkout/dist/index.js
|
STATE_isPost=1 node /actions/checkout/dist/index.js
|
||||||
|
|
||||||
docker save "${TARGET}:$TAG" |gzip >docker-save.tgz
|
docker save "${TARGET}:$TAG" |gzip >docker-save.tgz
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user