Dockerfile: run apache2 w/ mod_php and Icinga Web 2

This commit is contained in:
Alexander A. Klimov 2020-06-23 16:12:29 +02:00
parent 32fc20036d
commit 682db5f95a
6 changed files with 58 additions and 3 deletions

View File

@ -1 +1,8 @@
FROM debian:buster-slim
FROM icinga/icingaweb2-deps
COPY icingaweb2 /usr/share/icingaweb2
RUN ["ln", "-vs", "/usr/share/icingaweb2/packages/files/apache/icingaweb2.conf", "/etc/apache2/conf-enabled/"]
RUN ["ln", "-vs", "/usr/share/icingaweb2/bin/icingacli", "/usr/local/bin/"]
USER www-data
CMD ["bash", "-eo", "pipefail", "-c", ". /etc/apache2/envvars; exec apache2 -DFOREGROUND"]

View File

@ -27,7 +27,7 @@ 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 php7.3-zip ;\
composer docker-ce-cli git nodejs patch php7.3-zip ;\
apt-get clean ;\
rm -vrf /var/lib/apt/lists/*

View File

@ -1,5 +1,5 @@
FROM icinga/icingaweb2-builder
COPY action.bash Dockerfile get-mods.sh /
COPY action.bash Dockerfile get-mods.sh icingaweb2.patch /
CMD ["/action.bash"]

View File

@ -21,6 +21,8 @@ mkimg () {
popd
done
patch -d icingaweb2 -p0 < /icingaweb2.patch
docker build -f /Dockerfile -t "${TARGET}:$TAG" .
STATE_isPost=1 node /actions/checkout/dist/index.js

20
deps.Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM debian:buster-slim
RUN ["bash", "-exo", "pipefail", "-c", "export DEBIAN_FRONTEND=noninteractive; apt-get update; apt-get install --no-install-{recommends,suggests} -y locales; apt-get clean; rm -vrf /var/lib/apt/lists/*"]
RUN ["perl", "-pi", "-e", "if (/\\bUTF-8$/) { s/^# *// }", "/etc/locale.gen"]
RUN ["locale-gen", "-j", "4"]
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 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/*"]
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", "o+x", "/var/log/apache2"]
RUN ["chown", "www-data:www-data", "/var/run/apache2"]
RUN ["install", "-o", "www-data", "-g", "www-data", "-d", "/etc/icingaweb2"]

26
icingaweb2.patch Normal file
View File

@ -0,0 +1,26 @@
--- packages/files/apache/icingaweb2.conf
+++ packages/files/apache/icingaweb2.conf
@@ -1,4 +1,4 @@
-Alias /icingaweb2 "/usr/share/icingaweb2/public"
+Alias / "/usr/share/icingaweb2/public/"
# Remove comments if you want to use PHP FPM and your Apache version is older than 2.4
#<IfVersion < 2.4>
@@ -34,7 +34,7 @@ Alias /icingaweb2 "/usr/share/icingaweb2/public"
<IfModule mod_rewrite.c>
RewriteEngine on
- RewriteBase /icingaweb2/
+ RewriteBase /
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
@@ -44,7 +44,7 @@ Alias /icingaweb2 "/usr/share/icingaweb2/public"
<IfModule !mod_rewrite.c>
DirectoryIndex error_norewrite.html
- ErrorDocument 404 /icingaweb2/error_norewrite.html
+ ErrorDocument 404 /error_norewrite.html
</IfModule>
# Remove comments if you want to use PHP FPM and your Apache version