mirror of
https://github.com/zokradonh/kopano-docker.git
synced 2026-08-21 13:23:09 +00:00
add a common php image to base webapp, z-push and kdav on (#138)
* adapt webapp container for new php base image * clean out webapp dockerfile * complete switch of webapp to php-fpm * update config in web container * update readme * remove logging config from docker-compose.yml * add php container to tagging and publishing
This commit is contained in:
+1
-31
@@ -1,5 +1,5 @@
|
||||
ARG docker_repo=zokradonh
|
||||
FROM ${docker_repo}/kopano_base
|
||||
FROM ${docker_repo}/kopano_php
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
@@ -42,19 +42,16 @@ RUN \
|
||||
# community download and package as apt source repository
|
||||
. /kopano/helper/create-kopano-repo.sh && \
|
||||
if [ ${DOWNLOAD_COMMUNITY_PACKAGES} -eq 1 ]; then \
|
||||
dl_and_package_community "core"; \
|
||||
dl_and_package_community "webapp"; \
|
||||
dl_and_package_community "files"; \
|
||||
dl_and_package_community "mdm"; \
|
||||
dl_and_package_community "smime"; \
|
||||
fi; \
|
||||
echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_CORE_REPOSITORY_URL} ./" > /etc/apt/sources.list.d/kopano.list; \
|
||||
echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_WEBAPP_REPOSITORY_URL} ./" >> /etc/apt/sources.list.d/kopano.list; \
|
||||
echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_WEBAPP_SMIME_REPOSITORY_URL} ./" >> /etc/apt/sources.list.d/kopano.list; \
|
||||
echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_WEBAPP_MDM_REPOSITORY_URL} ./" >> /etc/apt/sources.list.d/kopano.list; \
|
||||
echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_WEBAPP_FILES_REPOSITORY_URL} ./" >> /etc/apt/sources.list.d/kopano.list; \
|
||||
# save kopano version
|
||||
echo "core-${KOPANO_CORE_VERSION}" > /kopano/buildversion; \
|
||||
echo "webapp-${KOPANO_WEBAPP_VERSION}" >> /kopano/buildversion; \
|
||||
echo "files-${KOPANO_WEBAPP_FILES_VERSION}" >> /kopano/buildversion; \
|
||||
echo "mdm-${KOPANO_WEBAPP_MDM_VERSION}" >> /kopano/buildversion; \
|
||||
@@ -66,38 +63,11 @@ RUN \
|
||||
# install
|
||||
set -x && \
|
||||
apt-get update && apt-get install -y --no-install-recommends \
|
||||
apache2 \
|
||||
libapache2-mod-php7.0 \
|
||||
crudini \
|
||||
ca-certificates \
|
||||
kopano-webapp \
|
||||
${ADDITIONAL_KOPANO_PACKAGES} \
|
||||
${ADDITIONAL_KOPANO_WEBAPP_PLUGINS} \
|
||||
&& rm -rf /var/cache/apt /var/lib/apt/lists
|
||||
|
||||
COPY apache2-kopano.conf /etc/apache2/sites-available/kopano.conf
|
||||
|
||||
# configure basics
|
||||
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
|
||||
sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen && \
|
||||
dpkg-reconfigure --frontend=noninteractive locales && \
|
||||
update-locale LANG=en_US.UTF-8 && \
|
||||
# configure apache
|
||||
rm /etc/apache2/sites-enabled/* && \
|
||||
sed -e 's,^ErrorLog.*,ErrorLog "|/bin/cat",' -i /etc/apache2/apache2.conf && \
|
||||
sed -e "s,MaxSpareServers[^:].*,MaxSpareServers 5," -i /etc/apache2/mods-available/mpm_prefork.conf && \
|
||||
a2disconf other-vhosts-access-log && \
|
||||
a2ensite kopano kopano-webapp && \
|
||||
echo "Listen 80" > /etc/apache2/ports.conf && \
|
||||
# configure mod_php
|
||||
a2enmod rewrite && \
|
||||
crudini --set /etc/php/7.0/apache2/php.ini PHP upload_max_filesize 500M && \
|
||||
crudini --set /etc/php/7.0/apache2/php.ini PHP post_max_size 500M && \
|
||||
crudini --set /etc/php/7.0/apache2/php.ini PHP max_input_vars 1800 && \
|
||||
crudini --set /etc/php/7.0/apache2/php.ini Session session.save_path /run/sessions
|
||||
|
||||
EXPOSE 80/tcp
|
||||
|
||||
COPY start.sh /kopano/start.sh
|
||||
|
||||
ENV LANG en_US.UTF-8
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
<VirtualHost *:80>
|
||||
DocumentRoot /usr/share/kopano-webapp
|
||||
|
||||
LogFormat "%{X-Forwarded-For}i %{%a %b %d %T %Y}t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
|
||||
ErrorLog "|/bin/cat"
|
||||
CustomLog "|/bin/cat" proxy
|
||||
|
||||
<Directory /usr/share/kopano-webapp/>
|
||||
DirectoryIndex index.php
|
||||
Options -Indexes +FollowSymLinks
|
||||
|
||||
<IfVersion < 2.4>
|
||||
Allow from all
|
||||
AllowOverride Options Limit
|
||||
Order allow,deny
|
||||
</IfVersion>
|
||||
|
||||
<IfVersion >= 2.4>
|
||||
AllowOverride Options Limit Authconfig
|
||||
Require all granted
|
||||
</IfVersion>
|
||||
|
||||
FileETag All
|
||||
|
||||
# Uncomment to enhance security of WebApp by restricting cookies to only
|
||||
# be provided over HTTPS connections
|
||||
# php_flag session.cookie_secure on
|
||||
# php_flag session.cookie_httponly on
|
||||
|
||||
# Manipulate the cache control headers if mod_expires and
|
||||
# mod_headers are both enabled; otherwise the client will depend
|
||||
# on the ETag header. However, you can set FileETag to "None" if
|
||||
# you have multiple servers serving WebApp to the same user. In
|
||||
# that case, apache will fall back to the config below so make
|
||||
# sure these two modules are loaded!
|
||||
<IfModule expires_module>
|
||||
<IfModule headers_module>
|
||||
ExpiresActive On
|
||||
ExpiresDefault "now"
|
||||
|
||||
<filesMatch "\.(jpg|gif|png)$">
|
||||
# All (static) resources set to 2 months expiration time.
|
||||
ExpiresDefault "access plus 2 months"
|
||||
Header append Cache-Control "public"
|
||||
</filesMatch>
|
||||
|
||||
<FilesMatch "\.(js|css)$">
|
||||
# All non-dynamic files set to 2 weeks expiration time.
|
||||
ExpiresDefault "access plus 2 weeks"
|
||||
# User agents are requested to revalidate for each resource
|
||||
# so that the server can always serve a newer version if
|
||||
# necessary.
|
||||
Header append Cache-Control "no-cache, must-revalidate"
|
||||
|
||||
# Treat IE a little differently due to the remarks on no-cache
|
||||
# on http://support.microsoft.com/kb/234067
|
||||
<IfModule setenvif_module>
|
||||
BrowserMatch MSIE ie_bug
|
||||
</IfModule>
|
||||
Header set Cache-Control "must-revalidate, private" env=ie_bug
|
||||
</FilesMatch>
|
||||
|
||||
<filesMatch "\.(php)$">
|
||||
# PHP files must always be retrieved from the server.
|
||||
ExpiresActive Off
|
||||
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
|
||||
Header set Pragma "no-cache"
|
||||
</filesMatch>
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
|
||||
# Enable gzip compression if the module is available
|
||||
<IfModule deflate_module>
|
||||
<filesMatch "\.(js|css)$">
|
||||
SetOutputFilter DEFLATE
|
||||
</filesMatch>
|
||||
</IfModule>
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
+5
-31
@@ -8,34 +8,8 @@ ADDITIONAL_KOPANO_WEBAPP_PLUGINS=${ADDITIONAL_KOPANO_WEBAPP_PLUGINS:-""}
|
||||
|
||||
set -eu # unset variables are errors & non-zero return values exit the whole script
|
||||
|
||||
php_cfg_gen() {
|
||||
local cfg_file="$1"
|
||||
local cfg_setting="$2"
|
||||
local cfg_value="$3"
|
||||
if [ -e "$cfg_file" ]; then
|
||||
echo "Setting $cfg_setting = $cfg_value in $cfg_file"
|
||||
if ! grep -q "$cfg_setting" "$cfg_file"; then
|
||||
echo "WARNING: Config option $cfg_setting not found in $cfg_file! You may have misspelled the confing setting."
|
||||
echo "define('$cfg_setting', '$cfg_value');" >> "$cfg_file"
|
||||
cat "$cfg_file"
|
||||
return
|
||||
fi
|
||||
case $cfg_value in
|
||||
true|TRUE|false|FALSE)
|
||||
sed -ri "s#(\s*define).+${cfg_setting}.+#\tdefine(\x27${cfg_setting}\x27, ${cfg_value}\);#g" "$cfg_file"
|
||||
;;
|
||||
*)
|
||||
sed -ri "s#(\s*define).+${cfg_setting}.+#\tdefine(\x27${cfg_setting}\x27, \x27${cfg_value}\x27\);#g" "$cfg_file"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "Error: Config file $cfg_file not found. Plugin not installed?"
|
||||
local dir
|
||||
dir=$(dirname "$cfg_file")
|
||||
ls -la "$dir"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
# shellcheck source=php/start-helper.sh
|
||||
source /kopano/start-helper.sh
|
||||
|
||||
ADDITIONAL_KOPANO_PACKAGES="$ADDITIONAL_KOPANO_PACKAGES $ADDITIONAL_KOPANO_WEBAPP_PLUGINS"
|
||||
|
||||
@@ -78,8 +52,8 @@ chown -R www-data:www-data /run/sessions /tmp/webapp
|
||||
echo "Starting Apache"
|
||||
rm -f /run/apache2/apache2.pid
|
||||
set +u
|
||||
# shellcheck disable=SC1091
|
||||
source /etc/apache2/envvars
|
||||
# cleaning up env variables
|
||||
unset "${!KCCONF_@}"
|
||||
exec /usr/sbin/apache2 -DFOREGROUND
|
||||
echo "Starting php-fpm"
|
||||
php-fpm7.0 -F &
|
||||
exec /usr/libexec/kopano/kwebd caddy -conf /etc/kweb.cfg
|
||||
Reference in New Issue
Block a user