mirror of
https://github.com/zokradonh/kopano-docker.git
synced 2026-08-20 04:43:06 +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:
@@ -0,0 +1,79 @@
|
||||
ARG docker_repo=zokradonh
|
||||
FROM ${docker_repo}/kopano_base
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
ARG ADDITIONAL_KOPANO_PACKAGES=""
|
||||
ENV ADDITIONAL_KOPANO_PACKAGES=$ADDITIONAL_KOPANO_PACKAGES
|
||||
ARG ADDITIONAL_KOPANO_WEBAPP_PLUGINS=""
|
||||
ENV ADDITIONAL_KOPANO_WEBAPP_PLUGINS=$ADDITIONAL_KOPANO_WEBAPP_PLUGINS
|
||||
ARG DOWNLOAD_COMMUNITY_PACKAGES=1
|
||||
ENV DOWNLOAD_COMMUNITY_PACKAGES=$DOWNLOAD_COMMUNITY_PACKAGES
|
||||
ARG KOPANO_CORE_REPOSITORY_URL="file:/kopano/repo/core"
|
||||
ENV KOPANO_CORE_REPOSITORY_URL=$KOPANO_CORE_REPOSITORY_URL
|
||||
ARG KOPANO_REPOSITORY_FLAGS="trusted=yes"
|
||||
ENV KOPANO_REPOSITORY_FLAGS=$KOPANO_REPOSITORY_FLAGS
|
||||
ARG KOPANO_WEBAPP_REPOSITORY_URL="file:/kopano/repo/webapp"
|
||||
ENV KOPANO_WEBAPP_REPOSITORY_URL=$KOPANO_WEBAPP_REPOSITORY_URL
|
||||
ARG KOPANO_WEBAPP_SMIME_REPOSITORY_URL="file:/kopano/repo/smime"
|
||||
ENV KOPANO_WEBAPP_SMIME_REPOSITORY_URL=$KOPANO_WEBAPP_SMIME_REPOSITORY_URL
|
||||
ARG KOPANO_WEBAPP_MDM_REPOSITORY_URL="file:/kopano/repo/mdm"
|
||||
ENV KOPANO_WEBAPP_MDM_REPOSITORY_URL=$KOPANO_WEBAPP_MDM_REPOSITORY_URL
|
||||
ARG KOPANO_WEBAPP_FILES_REPOSITORY_URL="file:/kopano/repo/files"
|
||||
ENV KOPANO_WEBAPP_FILES_REPOSITORY_URL=$KOPANO_WEBAPP_FILES_REPOSITORY_URL
|
||||
ARG KOPANO_CORE_VERSION=newest
|
||||
ENV KOPANO_CORE_VERSION=$KOPANO_CORE_VERSION
|
||||
ARG KOPANO_WEBAPP_VERSION=newest
|
||||
ENV KOPANO_WEBAPP_VERSION=$KOPANO_WEBAPP_VERSION
|
||||
ARG KOPANO_WEBAPP_FILES_VERSION=newest
|
||||
ENV KOPANO_WEBAPP_FILES_VERSION=$KOPANO_WEBAPP_FILES_VERSION
|
||||
ARG KOPANO_WEBAPP_MDM_VERSION=newest
|
||||
ENV KOPANO_WEBAPP_MDM_VERSION=$KOPANO_WEBAPP_MDM_VERSION
|
||||
ARG KOPANO_WEBAPP_SMIME_VERSION=newest
|
||||
ENV KOPANO_WEBAPP_SMIME_VERSION=$KOPANO_WEBAPP_SMIME_VERSION
|
||||
ARG RELEASE_KEY_DOWNLOAD=0
|
||||
ENV RELEASE_KEY_DOWNLOAD=$RELEASE_KEY_DOWNLOAD
|
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
# add install common php dependencies
|
||||
# hadolint ignore=SC2129
|
||||
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"; \
|
||||
fi; \
|
||||
echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_CORE_REPOSITORY_URL} ./" > /etc/apt/sources.list.d/kopano.list; \
|
||||
# save kopano version
|
||||
echo "core-${KOPANO_CORE_VERSION}" > /kopano/buildversion; \
|
||||
# install apt keys if supported kopano
|
||||
if [ ${RELEASE_KEY_DOWNLOAD} -eq 1 ]; then \
|
||||
curl -s -S -o - "${KOPANO_CORE_REPOSITORY_URL}/Release.key" | apt-key add -; \
|
||||
fi; \
|
||||
# install
|
||||
set -x && \
|
||||
apt-get update && apt-get install -y --no-install-recommends \
|
||||
kopano-kwebd \
|
||||
php-fpm \
|
||||
crudini \
|
||||
ca-certificates \
|
||||
${ADDITIONAL_KOPANO_PACKAGES} \
|
||||
&& rm -rf /var/cache/apt /var/lib/apt/lists
|
||||
|
||||
# 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 php-fpm
|
||||
mkdir -p /run/php && chown www-data:www-data /run/php && \
|
||||
crudini --set /etc/php/7.0/fpm/php.ini PHP upload_max_filesize 500M && \
|
||||
crudini --set /etc/php/7.0/fpm/php.ini PHP post_max_size 500M && \
|
||||
crudini --set /etc/php/7.0/fpm/php.ini PHP max_input_vars 1800 && \
|
||||
crudini --set /etc/php/7.0/fpm/php.ini Session session.save_path /run/sessions
|
||||
|
||||
EXPOSE 9080/tcp
|
||||
|
||||
COPY start-helper.sh /kopano/start-helper.sh
|
||||
COPY kweb.cfg /etc/kweb.cfg
|
||||
@@ -0,0 +1 @@
|
||||
Common base image for php based Kopano containers
|
||||
@@ -0,0 +1,10 @@
|
||||
:9080 {
|
||||
errors stderr
|
||||
|
||||
alias /webapp/ /usr/share/kopano-webapp/
|
||||
fastcgi2 /webapp/ /run/php/php7.0-fpm.sock php {
|
||||
without /webapp/
|
||||
root /usr/share/kopano-webapp/
|
||||
}
|
||||
folderish /webapp
|
||||
}
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user