Merge pull request #44 from Icinga/bugfix/deps

Merge Dockerfiles
This commit is contained in:
Noah Hilverling 2021-06-29 09:34:46 +02:00 committed by GitHub
commit d6ad8d2da2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 67 additions and 71 deletions

View File

@ -1,6 +1,36 @@
# Icinga Web 2 Docker image | (c) 2020 Icinga GmbH | GPLv2+
FROM icinga/icingaweb2-deps
FROM golang:buster as entrypoint
COPY entrypoint /entrypoint
WORKDIR /entrypoint
RUN ["go", "build", "."]
FROM debian:buster-slim
RUN ["bash", "-exo", "pipefail", "-c", "export DEBIAN_FRONTEND=noninteractive; apt-get update; apt-get install --no-install-{recommends,suggests} -y apache2 libapache2-mod-php7.3 locales-all php-{imagick,redis} php7.3-{bcmath,bz2,common,curl,dba,enchant,gd,gmp,imap,interbase,intl,json,ldap,mbstring,mysql,odbc,opcache,pgsql,pspell,readline,recode,snmp,soap,sqlite3,sybase,tidy,xml,xmlrpc,xsl,zip}; apt-get clean; rm -vrf /var/lib/apt/lists/*"]
COPY --from=entrypoint /entrypoint/entrypoint /entrypoint
COPY entrypoint/db-init /entrypoint-db-init
RUN ["a2enmod", "rewrite"]
RUN ["ln", "-vsf", "/dev/stdout", "/var/log/apache2/access.log"]
RUN ["ln", "-vsf", "/dev/stderr", "/var/log/apache2/error.log"]
RUN ["ln", "-vsf", "/dev/stdout", "/var/log/apache2/other_vhosts_access.log"]
RUN ["perl", "-pi", "-e", "if (/Listen/) { s/80/8080/ }", "/etc/apache2/ports.conf"]
RUN ["perl", "-pi", "-e", "if (/VirtualHost/) { s/80/8080/ }", "/etc/apache2/sites-available/000-default.conf"]
EXPOSE 8080
RUN ["chmod", "-R", "u=rwX,go=rX", "/entrypoint-db-init"]
RUN ["chmod", "o+x", "/var/log/apache2"]
RUN ["chown", "www-data:www-data", "/var/run/apache2"]
RUN ["ln", "-vs", "/data/etc/icingaweb2", "/etc/icingaweb2"]
RUN ["install", "-o", "www-data", "-g", "www-data", "-d", "/data"]
ENTRYPOINT ["/entrypoint"]
COPY icingaweb2 /usr/share/icingaweb2
COPY icinga-php /usr/share/icinga-php

View File

@ -1,34 +0,0 @@
# Icinga Web 2 Docker image | (c) 2020 Icinga GmbH | GPLv2+
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 ;\
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/docker.list
RUN apt-get update ;\
apt-get install --no-install-{recommends,suggests} -y \
composer docker-ce-cli git nodejs patch php7.3-zip ;\
apt-get clean ;\
rm -vrf /var/lib/apt/lists/*
COPY --from=clone /actions /actions

View File

@ -1,7 +1,39 @@
# Icinga Web 2 Docker image | (c) 2020 Icinga GmbH | GPLv2+
FROM icinga/icingaweb2-builder
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 ;\
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/docker.list
RUN apt-get update ;\
apt-get install --no-install-{recommends,suggests} -y \
composer docker-ce-cli git nodejs patch php7.3-zip ;\
apt-get clean ;\
rm -vrf /var/lib/apt/lists/*
COPY --from=clone /actions /actions
COPY action.bash composer.bash Dockerfile get-mods.sh icingaweb2.patch /
COPY entrypoint /entrypoint
CMD ["/action.bash"]

View File

@ -15,6 +15,7 @@ mkimg () {
/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

View File

@ -16,8 +16,7 @@ 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 build -f "${BLDCTX}/action.Dockerfile" -t icinga/icingaweb2-builder "$BLDCTX"
docker run --rm -i \
-v "${IW2SRC}:/iw2src:ro" \
@ -34,5 +33,6 @@ cd /iw2cp
/bldctx/composer.bash
patch -d icingaweb2 -p0 < /bldctx/icingaweb2.patch
cp -r /entrypoint .
docker build -f /bldctx/Dockerfile -t icinga/icingaweb2 .
EOF

View File

@ -1,33 +0,0 @@
# Icinga Web 2 Docker image | (c) 2020 Icinga GmbH | GPLv2+
FROM golang:buster as entrypoint
COPY entrypoint /entrypoint
WORKDIR /entrypoint
RUN ["go", "build", "."]
FROM debian:buster-slim
RUN ["bash", "-exo", "pipefail", "-c", "export DEBIAN_FRONTEND=noninteractive; apt-get update; apt-get install --no-install-{recommends,suggests} -y apache2 libapache2-mod-php7.3 locales-all php-{imagick,redis} php7.3-{bcmath,bz2,common,curl,dba,enchant,gd,gmp,imap,interbase,intl,json,ldap,mbstring,mysql,odbc,opcache,pgsql,pspell,readline,recode,snmp,soap,sqlite3,sybase,tidy,xml,xmlrpc,xsl,zip}; apt-get clean; rm -vrf /var/lib/apt/lists/*"]
COPY --from=entrypoint /entrypoint/entrypoint /entrypoint
COPY entrypoint/db-init /entrypoint-db-init
RUN ["a2enmod", "rewrite"]
RUN ["ln", "-vsf", "/dev/stdout", "/var/log/apache2/access.log"]
RUN ["ln", "-vsf", "/dev/stderr", "/var/log/apache2/error.log"]
RUN ["ln", "-vsf", "/dev/stdout", "/var/log/apache2/other_vhosts_access.log"]
RUN ["perl", "-pi", "-e", "if (/Listen/) { s/80/8080/ }", "/etc/apache2/ports.conf"]
RUN ["perl", "-pi", "-e", "if (/VirtualHost/) { s/80/8080/ }", "/etc/apache2/sites-available/000-default.conf"]
EXPOSE 8080
RUN ["chmod", "-R", "u=rwX,go=rX", "/entrypoint-db-init"]
RUN ["chmod", "o+x", "/var/log/apache2"]
RUN ["chown", "www-data:www-data", "/var/run/apache2"]
RUN ["ln", "-vs", "/data/etc/icingaweb2", "/etc/icingaweb2"]
RUN ["install", "-o", "www-data", "-g", "www-data", "-d", "/data"]
ENTRYPOINT ["/entrypoint"]