Add images for 1.5.x as built previously
authorPablo Zmdl <redacted>
Wed, 4 Jun 2025 08:58:42 +0000 (10:58 +0200)
committerPablo Zmdl <redacted>
Wed, 4 Jun 2025 08:58:42 +0000 (10:58 +0200)
If we build them we should have them visible in the main branch

apache-1.5.x/Dockerfile [new file with mode: 0644]
apache-1.5.x/docker-entrypoint.sh [new file with mode: 0755]
apache-1.5.x/php.ini [new file with mode: 0644]
fpm-1.5.x/Dockerfile [new file with mode: 0644]
fpm-1.5.x/docker-entrypoint.sh [new file with mode: 0755]
fpm-1.5.x/php.ini [new file with mode: 0644]
fpm-alpine-1.5.x/Dockerfile [new file with mode: 0644]
fpm-alpine-1.5.x/docker-entrypoint.sh [new file with mode: 0755]
fpm-alpine-1.5.x/php.ini [new file with mode: 0644]

diff --git a/apache-1.5.x/Dockerfile b/apache-1.5.x/Dockerfile
new file mode 100644 (file)
index 0000000..e76998e
--- /dev/null
@@ -0,0 +1,113 @@
+FROM php:7.4-apache
+LABEL maintainer="Thomas Bruederli <thomas@roundcube.net>"
+
+RUN set -ex; \
+       apt-get update; \
+       \
+       savedAptMark="$(apt-mark showmanual)"; \
+       \
+       apt-get install -y --no-install-recommends \
+               libfreetype6-dev \
+               libicu-dev \
+               libjpeg62-turbo-dev \
+               libldap2-dev \
+               libmagickwand-dev \
+               libpng-dev \
+               libpq-dev \
+               libsqlite3-dev \
+               libzip-dev \
+               libpspell-dev \
+               libonig-dev \
+               libldap-common \
+       ; \
+       \
+       debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
+       docker-php-ext-configure gd --with-jpeg --with-freetype; \
+       docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
+       docker-php-ext-install \
+               exif \
+               gd \
+               intl \
+               ldap \
+               pdo_mysql \
+               pdo_pgsql \
+               pdo_sqlite \
+               zip \
+               pspell \
+       ; \
+       pecl install imagick redis; \
+       docker-php-ext-enable imagick opcache redis; \
+       \
+# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
+       apt-mark auto '.*' > /dev/null; \
+       apt-mark manual $savedAptMark; \
+       ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
+               | awk '/=>/ { print $3 }' \
+               | sort -u \
+               | xargs -r dpkg-query -S \
+               | cut -d: -f1 \
+               | sort -u \
+               | xargs -rt apt-mark manual; \
+       \
+       apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
+       rm -rf /var/lib/apt/lists/*
+
+# installto.sh dependencies
+RUN set -ex; \
+       \
+       apt-get update; \
+       apt-get install -y --no-install-recommends \
+                       aspell \
+                       aspell-en \
+                       rsync \
+       ; \
+       rm -rf /var/lib/apt/lists/*
+
+COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
+
+RUN a2enmod rewrite
+
+# Define Roundcubemail version
+ENV ROUNDCUBEMAIL_VERSION 1.5.9
+
+# Define the GPG key used for the bundle verification process
+ENV ROUNDCUBEMAIL_KEYID "F3E4 C04B B3DB 5D42 15C4  5F7F 5AB2 BAA1 41C4 F7D5"
+
+# Download package and extract to web volume
+RUN set -ex; \
+       fetchDeps="gnupg dirmngr locales libc-l10n"; \
+       apt-get -qq update; \
+       apt-get install -y --no-install-recommends $fetchDeps; \
+       curl -o roundcubemail.tar.gz -fSL https://github.com/roundcube/roundcubemail/releases/download/${ROUNDCUBEMAIL_VERSION}/roundcubemail-${ROUNDCUBEMAIL_VERSION}-complete.tar.gz; \
+       curl -o roundcubemail.tar.gz.asc -fSL https://github.com/roundcube/roundcubemail/releases/download/${ROUNDCUBEMAIL_VERSION}/roundcubemail-${ROUNDCUBEMAIL_VERSION}-complete.tar.gz.asc; \
+       export GNUPGHOME="$(mktemp -d)"; \
+       # workaround for "Cannot assign requested address", see e.g. https://github.com/inversepath/usbarmory-debian-base_image/issues/9
+       echo "disable-ipv6" > "$GNUPGHOME/dirmngr.conf"; \
+       curl -fSL https://roundcube.net/download/pubkey.asc -o /tmp/pubkey.asc; \
+       LC_ALL=C.UTF-8 gpg -n --show-keys --with-fingerprint --keyid-format=long /tmp/pubkey.asc | if [ $(grep -c -o 'Key fingerprint') != 1 ]; then echo 'The key file should contain only one GPG key'; exit 1; fi; \
+       LC_ALL=C.UTF-8 gpg -n --show-keys --with-fingerprint --keyid-format=long /tmp/pubkey.asc | if [ $(grep -c -o "${ROUNDCUBEMAIL_KEYID}") != 1 ]; then echo 'The key ID should be the roundcube one'; exit 1; fi; \
+       gpg --batch --import /tmp/pubkey.asc; \
+       rm /tmp/pubkey.asc; \
+       gpg --batch --verify roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
+       gpgconf --kill all; \
+       mkdir /usr/src/roundcubemail; \
+       tar -xf roundcubemail.tar.gz -C /usr/src/roundcubemail --strip-components=1 --no-same-owner; \
+       rm -r "$GNUPGHOME" roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
+       rm -rf /usr/src/roundcubemail/installer; \
+       chown -R www-data:www-data /usr/src/roundcubemail/logs
+
+# copy the latest version of initdb.sh which supports the --update flag
+RUN curl -fL https://raw.githubusercontent.com/roundcube/roundcubemail/master/bin/initdb.sh > /usr/src/roundcubemail/bin/initdb.sh && chmod +x /usr/src/roundcubemail/bin/initdb.sh
+
+# include the wait-for-it.sh script
+RUN curl -fL https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /wait-for-it.sh && chmod +x /wait-for-it.sh
+
+# use custom PHP settings
+COPY php.ini /usr/local/etc/php/conf.d/roundcube-defaults.ini
+
+COPY --chmod=0755 docker-entrypoint.sh /
+
+RUN mkdir -p /var/roundcube/config
+
+ENTRYPOINT ["/docker-entrypoint.sh"]
+CMD ["apache2-foreground"]
diff --git a/apache-1.5.x/docker-entrypoint.sh b/apache-1.5.x/docker-entrypoint.sh
new file mode 100755 (executable)
index 0000000..3937945
--- /dev/null
@@ -0,0 +1,150 @@
+#!/bin/bash
+# set -ex
+
+# PWD=`pwd`
+
+if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
+  # docroot is empty
+  if ! [ -e index.php -a -e bin/installto.sh ]; then
+    echo >&2 "roundcubemail not found in $PWD - copying now..."
+    if [ "$(ls -A)" ]; then
+      echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
+      ( set -x; ls -A; sleep 10 )
+    fi
+    tar cf - --one-file-system -C /usr/src/roundcubemail . | tar xf -
+    echo >&2 "Complete! ROUNDCUBEMAIL has been successfully copied to $PWD"
+  # update Roundcube in docroot
+  else
+    INSTALLDIR=`pwd`
+    echo >&2 "roundcubemail found in $INSTALLDIR - installing update..."
+    (cd /usr/src/roundcubemail && bin/installto.sh -y $INSTALLDIR)
+    composer update --no-dev
+  fi
+
+  if [ -f /run/secrets/roundcube_db_user ]; then
+    ROUNDCUBEMAIL_DB_USER=`cat /run/secrets/roundcube_db_user`
+  fi
+  if [ -f /run/secrets/roundcube_db_password ]; then
+    ROUNDCUBEMAIL_DB_PASSWORD=`cat /run/secrets/roundcube_db_password`
+  fi
+
+  if [ ! -z "${!POSTGRES_ENV_POSTGRES_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "pgsql" ]; then
+    : "${ROUNDCUBEMAIL_DB_TYPE:=pgsql}"
+    : "${ROUNDCUBEMAIL_DB_HOST:=postgres}"
+    : "${ROUNDCUBEMAIL_DB_PORT:=5432}"
+    : "${ROUNDCUBEMAIL_DB_USER:=${POSTGRES_ENV_POSTGRES_USER}}"
+    : "${ROUNDCUBEMAIL_DB_PASSWORD:=${POSTGRES_ENV_POSTGRES_PASSWORD}}"
+    : "${ROUNDCUBEMAIL_DB_NAME:=${POSTGRES_ENV_POSTGRES_DB:-roundcubemail}}"
+    : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT}/${ROUNDCUBEMAIL_DB_NAME}}"
+
+    /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30
+  elif [ ! -z "${!MYSQL_ENV_MYSQL_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "mysql" ]; then
+    : "${ROUNDCUBEMAIL_DB_TYPE:=mysql}"
+    : "${ROUNDCUBEMAIL_DB_HOST:=mysql}"
+    : "${ROUNDCUBEMAIL_DB_PORT:=3306}"
+    : "${ROUNDCUBEMAIL_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}"
+    if [ "$ROUNDCUBEMAIL_DB_USER" = 'root' ]; then
+      : "${ROUNDCUBEMAIL_DB_PASSWORD:=${MYSQL_ENV_MYSQL_ROOT_PASSWORD}}"
+    else
+      : "${ROUNDCUBEMAIL_DB_PASSWORD:=${MYSQL_ENV_MYSQL_PASSWORD}}"
+    fi
+    : "${ROUNDCUBEMAIL_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-roundcubemail}}"
+    : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT}/${ROUNDCUBEMAIL_DB_NAME}}"
+
+    /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30
+  else
+    # use local SQLite DB in /var/roundcube/db
+    : "${ROUNDCUBEMAIL_DB_TYPE:=sqlite}"
+    : "${ROUNDCUBEMAIL_DB_DIR:=/var/roundcube/db}"
+    : "${ROUNDCUBEMAIL_DB_NAME:=sqlite}"
+    : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}:///$ROUNDCUBEMAIL_DB_DIR/${ROUNDCUBEMAIL_DB_NAME}.db?mode=0646}"
+
+    mkdir -p $ROUNDCUBEMAIL_DB_DIR
+    chown www-data:www-data $ROUNDCUBEMAIL_DB_DIR
+  fi
+
+  : "${ROUNDCUBEMAIL_DEFAULT_HOST:=localhost}"
+  : "${ROUNDCUBEMAIL_DEFAULT_PORT:=143}"
+  : "${ROUNDCUBEMAIL_SMTP_SERVER:=localhost}"
+  : "${ROUNDCUBEMAIL_SMTP_PORT:=587}"
+  : "${ROUNDCUBEMAIL_PLUGINS:=archive,zipdownload}"
+  : "${ROUNDCUBEMAIL_SKIN:=elastic}"
+  : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}"
+
+  if [ ! -e config/config.inc.php ]; then
+    GENERATED_DES_KEY=`head /dev/urandom | base64 | head -c 24`
+    touch config/config.inc.php
+
+    echo "Write root config to $PWD/config/config.inc.php"
+    echo "<?php
+    \$config['plugins'] = [];
+    \$config['log_driver'] = 'stdout';
+    \$config['zipdownload_selection'] = true;
+    \$config['des_key'] = '${GENERATED_DES_KEY}';
+    \$config['enable_spellcheck'] = true;
+    \$config['spellcheck_engine'] = 'pspell';
+    include(__DIR__ . '/config.docker.inc.php');
+    " > config/config.inc.php
+
+  elif ! grep -q "config.docker.inc.php" config/config.inc.php; then
+    echo "include(__DIR__ . '/config.docker.inc.php');" >> config/config.inc.php
+  fi
+
+  ROUNDCUBEMAIL_PLUGINS_PHP=`echo "${ROUNDCUBEMAIL_PLUGINS}" | sed -E "s/[, ]+/', '/g"`
+  echo "Write Docker config to $PWD/config/config.docker.inc.php"
+  echo "<?php
+  \$config['db_dsnw'] = '${ROUNDCUBEMAIL_DSNW}';
+  \$config['db_dsnr'] = '${ROUNDCUBEMAIL_DSNR}';
+  \$config['default_host'] = '${ROUNDCUBEMAIL_DEFAULT_HOST}';
+  \$config['default_port'] = '${ROUNDCUBEMAIL_DEFAULT_PORT}';
+  \$config['smtp_server'] = '${ROUNDCUBEMAIL_SMTP_SERVER}';
+  \$config['smtp_port'] = '${ROUNDCUBEMAIL_SMTP_PORT}';
+  \$config['temp_dir'] = '${ROUNDCUBEMAIL_TEMP_DIR}';
+  \$config['skin'] = '${ROUNDCUBEMAIL_SKIN}';
+  \$config['plugins'] = array_filter(array_unique(array_merge(\$config['plugins'], ['${ROUNDCUBEMAIL_PLUGINS_PHP}'])));
+  " > config/config.docker.inc.php
+
+  if [ -e /run/secrets/roundcube_des_key ]; then
+    echo "\$config['des_key'] = file_get_contents('/run/secrets/roundcube_des_key');" >> config/config.docker.inc.php
+  elif [ ! -z "${ROUNDCUBEMAIL_DES_KEY}" ]; then
+    echo "\$config['des_key'] = getenv('ROUNDCUBEMAIL_DES_KEY');" >> config/config.docker.inc.php
+  fi
+
+  if [ ! -z "${ROUNDCUBEMAIL_SPELLCHECK_URI}"]; then
+    echo "\$config['spellcheck_engine'] = 'googie';" >> config/config.docker.inc.php
+    echo "\$config['spellcheck_uri'] = '${ROUNDCUBEMAIL_SPELLCHECK_URI}';" >> config/config.docker.inc.php
+  fi
+
+  # include custom config files
+  for fn in `ls /var/roundcube/config/*.php 2>/dev/null || true`; do
+    echo "include('$fn');" >> config/config.docker.inc.php
+  done
+
+  # initialize or update DB
+  bin/initdb.sh --dir=$PWD/SQL --update || echo "Failed to initialize/update the database. Please start with an empty database and restart the container."
+
+  if [ ! -z "${ROUNDCUBEMAIL_TEMP_DIR}" ]; then
+    mkdir -p ${ROUNDCUBEMAIL_TEMP_DIR} && chown www-data ${ROUNDCUBEMAIL_TEMP_DIR}
+  fi
+
+  if [ ! -z "${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" ]; then
+    echo "upload_max_filesize=${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" >> /usr/local/etc/php/conf.d/roundcube-override.ini
+    echo "post_max_size=${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" >> /usr/local/etc/php/conf.d/roundcube-override.ini
+  fi
+
+  : "${ROUNDCUBEMAIL_LOCALE:=en_US.UTF-8 UTF-8}"
+
+  if [ -e /usr/sbin/locale-gen ] && [ ! -z "${ROUNDCUBEMAIL_LOCALE}" ]; then
+    echo "${ROUNDCUBEMAIL_LOCALE}" > /etc/locale.gen
+    /usr/sbin/locale-gen
+  fi
+
+  if [ ! -z "${ROUNDCUBEMAIL_ASPELL_DICTS}" ]; then
+    ASPELL_PACKAGES=`echo -n "aspell-${ROUNDCUBEMAIL_ASPELL_DICTS}" | sed -E "s/[, ]+/ aspell-/g"`
+    which apt-get && apt-get install -y $ASPELL_PACKAGES
+    which apk && apk add --no-cache $ASPELL_PACKAGES
+  fi
+
+fi
+
+exec "$@"
diff --git a/apache-1.5.x/php.ini b/apache-1.5.x/php.ini
new file mode 100644 (file)
index 0000000..7b2147d
--- /dev/null
@@ -0,0 +1,10 @@
+memory_limit=64M
+display_errors=Off
+log_errors=On
+upload_max_filesize=5M
+post_max_size=6M
+zlib.output_compression=Off
+session.auto_start=Off
+session.gc_maxlifetime=21600
+session.gc_divisor=500
+session.gc_probability=1
diff --git a/fpm-1.5.x/Dockerfile b/fpm-1.5.x/Dockerfile
new file mode 100644 (file)
index 0000000..a35874d
--- /dev/null
@@ -0,0 +1,112 @@
+FROM php:7.4-fpm
+LABEL maintainer="Thomas Bruederli <thomas@roundcube.net>"
+
+RUN set -ex; \
+       apt-get update; \
+       \
+       savedAptMark="$(apt-mark showmanual)"; \
+       \
+       apt-get install -y --no-install-recommends \
+               libfreetype6-dev \
+               libicu-dev \
+               libjpeg62-turbo-dev \
+               libldap2-dev \
+               libmagickwand-dev \
+               libpng-dev \
+               libpq-dev \
+               libsqlite3-dev \
+               libzip-dev \
+               libpspell-dev \
+               libonig-dev \
+               libldap-common \
+       ; \
+       \
+       debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
+       docker-php-ext-configure gd --with-jpeg --with-freetype; \
+       docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
+       docker-php-ext-install \
+               exif \
+               gd \
+               intl \
+               ldap \
+               pdo_mysql \
+               pdo_pgsql \
+               pdo_sqlite \
+               zip \
+               pspell \
+       ; \
+       pecl install imagick redis; \
+       docker-php-ext-enable imagick opcache redis; \
+       \
+# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
+       apt-mark auto '.*' > /dev/null; \
+       apt-mark manual $savedAptMark; \
+       ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
+               | awk '/=>/ { print $3 }' \
+               | sort -u \
+               | xargs -r dpkg-query -S \
+               | cut -d: -f1 \
+               | sort -u \
+               | xargs -rt apt-mark manual; \
+       \
+       apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
+       rm -rf /var/lib/apt/lists/*
+
+# installto.sh dependencies
+RUN set -ex; \
+       \
+       apt-get update; \
+       apt-get install -y --no-install-recommends \
+                       aspell \
+                       aspell-en \
+                       rsync \
+       ; \
+       rm -rf /var/lib/apt/lists/*
+
+COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
+
+
+# Define Roundcubemail version
+ENV ROUNDCUBEMAIL_VERSION 1.5.9
+
+# Define the GPG key used for the bundle verification process
+ENV ROUNDCUBEMAIL_KEYID "F3E4 C04B B3DB 5D42 15C4  5F7F 5AB2 BAA1 41C4 F7D5"
+
+# Download package and extract to web volume
+RUN set -ex; \
+       fetchDeps="gnupg dirmngr locales libc-l10n"; \
+       apt-get -qq update; \
+       apt-get install -y --no-install-recommends $fetchDeps; \
+       curl -o roundcubemail.tar.gz -fSL https://github.com/roundcube/roundcubemail/releases/download/${ROUNDCUBEMAIL_VERSION}/roundcubemail-${ROUNDCUBEMAIL_VERSION}-complete.tar.gz; \
+       curl -o roundcubemail.tar.gz.asc -fSL https://github.com/roundcube/roundcubemail/releases/download/${ROUNDCUBEMAIL_VERSION}/roundcubemail-${ROUNDCUBEMAIL_VERSION}-complete.tar.gz.asc; \
+       export GNUPGHOME="$(mktemp -d)"; \
+       # workaround for "Cannot assign requested address", see e.g. https://github.com/inversepath/usbarmory-debian-base_image/issues/9
+       echo "disable-ipv6" > "$GNUPGHOME/dirmngr.conf"; \
+       curl -fSL https://roundcube.net/download/pubkey.asc -o /tmp/pubkey.asc; \
+       LC_ALL=C.UTF-8 gpg -n --show-keys --with-fingerprint --keyid-format=long /tmp/pubkey.asc | if [ $(grep -c -o 'Key fingerprint') != 1 ]; then echo 'The key file should contain only one GPG key'; exit 1; fi; \
+       LC_ALL=C.UTF-8 gpg -n --show-keys --with-fingerprint --keyid-format=long /tmp/pubkey.asc | if [ $(grep -c -o "${ROUNDCUBEMAIL_KEYID}") != 1 ]; then echo 'The key ID should be the roundcube one'; exit 1; fi; \
+       gpg --batch --import /tmp/pubkey.asc; \
+       rm /tmp/pubkey.asc; \
+       gpg --batch --verify roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
+       gpgconf --kill all; \
+       mkdir /usr/src/roundcubemail; \
+       tar -xf roundcubemail.tar.gz -C /usr/src/roundcubemail --strip-components=1 --no-same-owner; \
+       rm -r "$GNUPGHOME" roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
+       rm -rf /usr/src/roundcubemail/installer; \
+       chown -R www-data:www-data /usr/src/roundcubemail/logs
+
+# copy the latest version of initdb.sh which supports the --update flag
+RUN curl -fL https://raw.githubusercontent.com/roundcube/roundcubemail/master/bin/initdb.sh > /usr/src/roundcubemail/bin/initdb.sh && chmod +x /usr/src/roundcubemail/bin/initdb.sh
+
+# include the wait-for-it.sh script
+RUN curl -fL https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /wait-for-it.sh && chmod +x /wait-for-it.sh
+
+# use custom PHP settings
+COPY php.ini /usr/local/etc/php/conf.d/roundcube-defaults.ini
+
+COPY --chmod=0755 docker-entrypoint.sh /
+
+RUN mkdir -p /var/roundcube/config
+
+ENTRYPOINT ["/docker-entrypoint.sh"]
+CMD ["php-fpm"]
diff --git a/fpm-1.5.x/docker-entrypoint.sh b/fpm-1.5.x/docker-entrypoint.sh
new file mode 100755 (executable)
index 0000000..3937945
--- /dev/null
@@ -0,0 +1,150 @@
+#!/bin/bash
+# set -ex
+
+# PWD=`pwd`
+
+if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
+  # docroot is empty
+  if ! [ -e index.php -a -e bin/installto.sh ]; then
+    echo >&2 "roundcubemail not found in $PWD - copying now..."
+    if [ "$(ls -A)" ]; then
+      echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
+      ( set -x; ls -A; sleep 10 )
+    fi
+    tar cf - --one-file-system -C /usr/src/roundcubemail . | tar xf -
+    echo >&2 "Complete! ROUNDCUBEMAIL has been successfully copied to $PWD"
+  # update Roundcube in docroot
+  else
+    INSTALLDIR=`pwd`
+    echo >&2 "roundcubemail found in $INSTALLDIR - installing update..."
+    (cd /usr/src/roundcubemail && bin/installto.sh -y $INSTALLDIR)
+    composer update --no-dev
+  fi
+
+  if [ -f /run/secrets/roundcube_db_user ]; then
+    ROUNDCUBEMAIL_DB_USER=`cat /run/secrets/roundcube_db_user`
+  fi
+  if [ -f /run/secrets/roundcube_db_password ]; then
+    ROUNDCUBEMAIL_DB_PASSWORD=`cat /run/secrets/roundcube_db_password`
+  fi
+
+  if [ ! -z "${!POSTGRES_ENV_POSTGRES_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "pgsql" ]; then
+    : "${ROUNDCUBEMAIL_DB_TYPE:=pgsql}"
+    : "${ROUNDCUBEMAIL_DB_HOST:=postgres}"
+    : "${ROUNDCUBEMAIL_DB_PORT:=5432}"
+    : "${ROUNDCUBEMAIL_DB_USER:=${POSTGRES_ENV_POSTGRES_USER}}"
+    : "${ROUNDCUBEMAIL_DB_PASSWORD:=${POSTGRES_ENV_POSTGRES_PASSWORD}}"
+    : "${ROUNDCUBEMAIL_DB_NAME:=${POSTGRES_ENV_POSTGRES_DB:-roundcubemail}}"
+    : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT}/${ROUNDCUBEMAIL_DB_NAME}}"
+
+    /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30
+  elif [ ! -z "${!MYSQL_ENV_MYSQL_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "mysql" ]; then
+    : "${ROUNDCUBEMAIL_DB_TYPE:=mysql}"
+    : "${ROUNDCUBEMAIL_DB_HOST:=mysql}"
+    : "${ROUNDCUBEMAIL_DB_PORT:=3306}"
+    : "${ROUNDCUBEMAIL_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}"
+    if [ "$ROUNDCUBEMAIL_DB_USER" = 'root' ]; then
+      : "${ROUNDCUBEMAIL_DB_PASSWORD:=${MYSQL_ENV_MYSQL_ROOT_PASSWORD}}"
+    else
+      : "${ROUNDCUBEMAIL_DB_PASSWORD:=${MYSQL_ENV_MYSQL_PASSWORD}}"
+    fi
+    : "${ROUNDCUBEMAIL_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-roundcubemail}}"
+    : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT}/${ROUNDCUBEMAIL_DB_NAME}}"
+
+    /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30
+  else
+    # use local SQLite DB in /var/roundcube/db
+    : "${ROUNDCUBEMAIL_DB_TYPE:=sqlite}"
+    : "${ROUNDCUBEMAIL_DB_DIR:=/var/roundcube/db}"
+    : "${ROUNDCUBEMAIL_DB_NAME:=sqlite}"
+    : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}:///$ROUNDCUBEMAIL_DB_DIR/${ROUNDCUBEMAIL_DB_NAME}.db?mode=0646}"
+
+    mkdir -p $ROUNDCUBEMAIL_DB_DIR
+    chown www-data:www-data $ROUNDCUBEMAIL_DB_DIR
+  fi
+
+  : "${ROUNDCUBEMAIL_DEFAULT_HOST:=localhost}"
+  : "${ROUNDCUBEMAIL_DEFAULT_PORT:=143}"
+  : "${ROUNDCUBEMAIL_SMTP_SERVER:=localhost}"
+  : "${ROUNDCUBEMAIL_SMTP_PORT:=587}"
+  : "${ROUNDCUBEMAIL_PLUGINS:=archive,zipdownload}"
+  : "${ROUNDCUBEMAIL_SKIN:=elastic}"
+  : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}"
+
+  if [ ! -e config/config.inc.php ]; then
+    GENERATED_DES_KEY=`head /dev/urandom | base64 | head -c 24`
+    touch config/config.inc.php
+
+    echo "Write root config to $PWD/config/config.inc.php"
+    echo "<?php
+    \$config['plugins'] = [];
+    \$config['log_driver'] = 'stdout';
+    \$config['zipdownload_selection'] = true;
+    \$config['des_key'] = '${GENERATED_DES_KEY}';
+    \$config['enable_spellcheck'] = true;
+    \$config['spellcheck_engine'] = 'pspell';
+    include(__DIR__ . '/config.docker.inc.php');
+    " > config/config.inc.php
+
+  elif ! grep -q "config.docker.inc.php" config/config.inc.php; then
+    echo "include(__DIR__ . '/config.docker.inc.php');" >> config/config.inc.php
+  fi
+
+  ROUNDCUBEMAIL_PLUGINS_PHP=`echo "${ROUNDCUBEMAIL_PLUGINS}" | sed -E "s/[, ]+/', '/g"`
+  echo "Write Docker config to $PWD/config/config.docker.inc.php"
+  echo "<?php
+  \$config['db_dsnw'] = '${ROUNDCUBEMAIL_DSNW}';
+  \$config['db_dsnr'] = '${ROUNDCUBEMAIL_DSNR}';
+  \$config['default_host'] = '${ROUNDCUBEMAIL_DEFAULT_HOST}';
+  \$config['default_port'] = '${ROUNDCUBEMAIL_DEFAULT_PORT}';
+  \$config['smtp_server'] = '${ROUNDCUBEMAIL_SMTP_SERVER}';
+  \$config['smtp_port'] = '${ROUNDCUBEMAIL_SMTP_PORT}';
+  \$config['temp_dir'] = '${ROUNDCUBEMAIL_TEMP_DIR}';
+  \$config['skin'] = '${ROUNDCUBEMAIL_SKIN}';
+  \$config['plugins'] = array_filter(array_unique(array_merge(\$config['plugins'], ['${ROUNDCUBEMAIL_PLUGINS_PHP}'])));
+  " > config/config.docker.inc.php
+
+  if [ -e /run/secrets/roundcube_des_key ]; then
+    echo "\$config['des_key'] = file_get_contents('/run/secrets/roundcube_des_key');" >> config/config.docker.inc.php
+  elif [ ! -z "${ROUNDCUBEMAIL_DES_KEY}" ]; then
+    echo "\$config['des_key'] = getenv('ROUNDCUBEMAIL_DES_KEY');" >> config/config.docker.inc.php
+  fi
+
+  if [ ! -z "${ROUNDCUBEMAIL_SPELLCHECK_URI}"]; then
+    echo "\$config['spellcheck_engine'] = 'googie';" >> config/config.docker.inc.php
+    echo "\$config['spellcheck_uri'] = '${ROUNDCUBEMAIL_SPELLCHECK_URI}';" >> config/config.docker.inc.php
+  fi
+
+  # include custom config files
+  for fn in `ls /var/roundcube/config/*.php 2>/dev/null || true`; do
+    echo "include('$fn');" >> config/config.docker.inc.php
+  done
+
+  # initialize or update DB
+  bin/initdb.sh --dir=$PWD/SQL --update || echo "Failed to initialize/update the database. Please start with an empty database and restart the container."
+
+  if [ ! -z "${ROUNDCUBEMAIL_TEMP_DIR}" ]; then
+    mkdir -p ${ROUNDCUBEMAIL_TEMP_DIR} && chown www-data ${ROUNDCUBEMAIL_TEMP_DIR}
+  fi
+
+  if [ ! -z "${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" ]; then
+    echo "upload_max_filesize=${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" >> /usr/local/etc/php/conf.d/roundcube-override.ini
+    echo "post_max_size=${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" >> /usr/local/etc/php/conf.d/roundcube-override.ini
+  fi
+
+  : "${ROUNDCUBEMAIL_LOCALE:=en_US.UTF-8 UTF-8}"
+
+  if [ -e /usr/sbin/locale-gen ] && [ ! -z "${ROUNDCUBEMAIL_LOCALE}" ]; then
+    echo "${ROUNDCUBEMAIL_LOCALE}" > /etc/locale.gen
+    /usr/sbin/locale-gen
+  fi
+
+  if [ ! -z "${ROUNDCUBEMAIL_ASPELL_DICTS}" ]; then
+    ASPELL_PACKAGES=`echo -n "aspell-${ROUNDCUBEMAIL_ASPELL_DICTS}" | sed -E "s/[, ]+/ aspell-/g"`
+    which apt-get && apt-get install -y $ASPELL_PACKAGES
+    which apk && apk add --no-cache $ASPELL_PACKAGES
+  fi
+
+fi
+
+exec "$@"
diff --git a/fpm-1.5.x/php.ini b/fpm-1.5.x/php.ini
new file mode 100644 (file)
index 0000000..7b2147d
--- /dev/null
@@ -0,0 +1,10 @@
+memory_limit=64M
+display_errors=Off
+log_errors=On
+upload_max_filesize=5M
+post_max_size=6M
+zlib.output_compression=Off
+session.auto_start=Off
+session.gc_maxlifetime=21600
+session.gc_divisor=500
+session.gc_probability=1
diff --git a/fpm-alpine-1.5.x/Dockerfile b/fpm-alpine-1.5.x/Dockerfile
new file mode 100644 (file)
index 0000000..5dbde54
--- /dev/null
@@ -0,0 +1,105 @@
+FROM php:7.4-fpm-alpine
+LABEL maintainer="Thomas Bruederli <thomas@roundcube.net>"
+
+# entrypoint.sh and installto.sh dependencies
+RUN set -ex; \
+       \
+       apk add --no-cache \
+               bash \
+               coreutils \
+               rsync \
+               tzdata \
+               aspell \
+               aspell-en
+
+RUN set -ex; \
+       \
+       apk add --no-cache --virtual .build-deps \
+               $PHPIZE_DEPS \
+               icu-dev \
+               freetype-dev \
+               imagemagick-dev \
+               libjpeg-turbo-dev \
+               libpng-dev \
+               libzip-dev \
+               libtool \
+               openldap-dev \
+               postgresql-dev \
+               sqlite-dev \
+               aspell-dev \
+       ; \
+       \
+       docker-php-ext-configure gd --with-jpeg --with-freetype; \
+       docker-php-ext-configure ldap; \
+       docker-php-ext-install \
+               exif \
+               gd \
+               intl \
+               ldap \
+               pdo_mysql \
+               pdo_pgsql \
+               pdo_sqlite \
+               zip \
+               pspell \
+       ; \
+       pecl install imagick redis; \
+       docker-php-ext-enable imagick opcache redis; \
+       \
+       runDeps="$( \
+               scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
+               | tr ',' '\n' \
+               | sort -u \
+               | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
+               )"; \
+       apk add --virtual .roundcubemail-phpext-rundeps imagemagick $runDeps; \
+       apk del .build-deps
+
+COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
+
+
+# Define Roundcubemail version
+ENV ROUNDCUBEMAIL_VERSION 1.5.9
+
+# Define the GPG key used for the bundle verification process
+ENV ROUNDCUBEMAIL_KEYID "F3E4 C04B B3DB 5D42 15C4  5F7F 5AB2 BAA1 41C4 F7D5"
+
+# Download package and extract to web volume
+RUN set -ex; \
+       apk add --no-cache --virtual .fetch-deps \
+               gnupg \
+       ; \
+       \
+       curl -o roundcubemail.tar.gz -fSL https://github.com/roundcube/roundcubemail/releases/download/${ROUNDCUBEMAIL_VERSION}/roundcubemail-${ROUNDCUBEMAIL_VERSION}-complete.tar.gz; \
+       curl -o roundcubemail.tar.gz.asc -fSL https://github.com/roundcube/roundcubemail/releases/download/${ROUNDCUBEMAIL_VERSION}/roundcubemail-${ROUNDCUBEMAIL_VERSION}-complete.tar.gz.asc; \
+       export GNUPGHOME="$(mktemp -d)"; \
+       # workaround for "Cannot assign requested address", see e.g. https://github.com/inversepath/usbarmory-debian-base_image/issues/9
+       echo "disable-ipv6" > "$GNUPGHOME/dirmngr.conf"; \
+       curl -fSL https://roundcube.net/download/pubkey.asc -o /tmp/pubkey.asc; \
+       LC_ALL=C.UTF-8 gpg -n --show-keys --with-fingerprint --keyid-format=long /tmp/pubkey.asc | if [ $(grep -c -o 'Key fingerprint') != 1 ]; then echo 'The key file should contain only one GPG key'; exit 1; fi; \
+       LC_ALL=C.UTF-8 gpg -n --show-keys --with-fingerprint --keyid-format=long /tmp/pubkey.asc | if [ $(grep -c -o "${ROUNDCUBEMAIL_KEYID}") != 1 ]; then echo 'The key ID should be the roundcube one'; exit 1; fi; \
+       gpg --batch --import /tmp/pubkey.asc; \
+       rm /tmp/pubkey.asc; \
+       gpg --batch --verify roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
+       gpgconf --kill all; \
+       mkdir /usr/src/roundcubemail; \
+       tar -xf roundcubemail.tar.gz -C /usr/src/roundcubemail --strip-components=1 --no-same-owner; \
+       rm -r "$GNUPGHOME" roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
+       rm -rf /usr/src/roundcubemail/installer; \
+       chown -R www-data:www-data /usr/src/roundcubemail/logs; \
+       apk del .fetch-deps
+
+# copy the latest version of initdb.sh which supports the --update flag
+RUN curl -fL https://raw.githubusercontent.com/roundcube/roundcubemail/master/bin/initdb.sh > /usr/src/roundcubemail/bin/initdb.sh && chmod +x /usr/src/roundcubemail/bin/initdb.sh
+
+# include the wait-for-it.sh script
+RUN curl -fL https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /wait-for-it.sh && chmod +x /wait-for-it.sh
+
+# use custom PHP settings
+COPY php.ini /usr/local/etc/php/conf.d/roundcube-defaults.ini
+
+COPY --chmod=0755 docker-entrypoint.sh /
+
+RUN mkdir -p /var/roundcube/config
+
+ENTRYPOINT ["/docker-entrypoint.sh"]
+CMD ["php-fpm"]
diff --git a/fpm-alpine-1.5.x/docker-entrypoint.sh b/fpm-alpine-1.5.x/docker-entrypoint.sh
new file mode 100755 (executable)
index 0000000..3937945
--- /dev/null
@@ -0,0 +1,150 @@
+#!/bin/bash
+# set -ex
+
+# PWD=`pwd`
+
+if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
+  # docroot is empty
+  if ! [ -e index.php -a -e bin/installto.sh ]; then
+    echo >&2 "roundcubemail not found in $PWD - copying now..."
+    if [ "$(ls -A)" ]; then
+      echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
+      ( set -x; ls -A; sleep 10 )
+    fi
+    tar cf - --one-file-system -C /usr/src/roundcubemail . | tar xf -
+    echo >&2 "Complete! ROUNDCUBEMAIL has been successfully copied to $PWD"
+  # update Roundcube in docroot
+  else
+    INSTALLDIR=`pwd`
+    echo >&2 "roundcubemail found in $INSTALLDIR - installing update..."
+    (cd /usr/src/roundcubemail && bin/installto.sh -y $INSTALLDIR)
+    composer update --no-dev
+  fi
+
+  if [ -f /run/secrets/roundcube_db_user ]; then
+    ROUNDCUBEMAIL_DB_USER=`cat /run/secrets/roundcube_db_user`
+  fi
+  if [ -f /run/secrets/roundcube_db_password ]; then
+    ROUNDCUBEMAIL_DB_PASSWORD=`cat /run/secrets/roundcube_db_password`
+  fi
+
+  if [ ! -z "${!POSTGRES_ENV_POSTGRES_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "pgsql" ]; then
+    : "${ROUNDCUBEMAIL_DB_TYPE:=pgsql}"
+    : "${ROUNDCUBEMAIL_DB_HOST:=postgres}"
+    : "${ROUNDCUBEMAIL_DB_PORT:=5432}"
+    : "${ROUNDCUBEMAIL_DB_USER:=${POSTGRES_ENV_POSTGRES_USER}}"
+    : "${ROUNDCUBEMAIL_DB_PASSWORD:=${POSTGRES_ENV_POSTGRES_PASSWORD}}"
+    : "${ROUNDCUBEMAIL_DB_NAME:=${POSTGRES_ENV_POSTGRES_DB:-roundcubemail}}"
+    : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT}/${ROUNDCUBEMAIL_DB_NAME}}"
+
+    /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30
+  elif [ ! -z "${!MYSQL_ENV_MYSQL_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "mysql" ]; then
+    : "${ROUNDCUBEMAIL_DB_TYPE:=mysql}"
+    : "${ROUNDCUBEMAIL_DB_HOST:=mysql}"
+    : "${ROUNDCUBEMAIL_DB_PORT:=3306}"
+    : "${ROUNDCUBEMAIL_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}"
+    if [ "$ROUNDCUBEMAIL_DB_USER" = 'root' ]; then
+      : "${ROUNDCUBEMAIL_DB_PASSWORD:=${MYSQL_ENV_MYSQL_ROOT_PASSWORD}}"
+    else
+      : "${ROUNDCUBEMAIL_DB_PASSWORD:=${MYSQL_ENV_MYSQL_PASSWORD}}"
+    fi
+    : "${ROUNDCUBEMAIL_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-roundcubemail}}"
+    : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT}/${ROUNDCUBEMAIL_DB_NAME}}"
+
+    /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30
+  else
+    # use local SQLite DB in /var/roundcube/db
+    : "${ROUNDCUBEMAIL_DB_TYPE:=sqlite}"
+    : "${ROUNDCUBEMAIL_DB_DIR:=/var/roundcube/db}"
+    : "${ROUNDCUBEMAIL_DB_NAME:=sqlite}"
+    : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}:///$ROUNDCUBEMAIL_DB_DIR/${ROUNDCUBEMAIL_DB_NAME}.db?mode=0646}"
+
+    mkdir -p $ROUNDCUBEMAIL_DB_DIR
+    chown www-data:www-data $ROUNDCUBEMAIL_DB_DIR
+  fi
+
+  : "${ROUNDCUBEMAIL_DEFAULT_HOST:=localhost}"
+  : "${ROUNDCUBEMAIL_DEFAULT_PORT:=143}"
+  : "${ROUNDCUBEMAIL_SMTP_SERVER:=localhost}"
+  : "${ROUNDCUBEMAIL_SMTP_PORT:=587}"
+  : "${ROUNDCUBEMAIL_PLUGINS:=archive,zipdownload}"
+  : "${ROUNDCUBEMAIL_SKIN:=elastic}"
+  : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}"
+
+  if [ ! -e config/config.inc.php ]; then
+    GENERATED_DES_KEY=`head /dev/urandom | base64 | head -c 24`
+    touch config/config.inc.php
+
+    echo "Write root config to $PWD/config/config.inc.php"
+    echo "<?php
+    \$config['plugins'] = [];
+    \$config['log_driver'] = 'stdout';
+    \$config['zipdownload_selection'] = true;
+    \$config['des_key'] = '${GENERATED_DES_KEY}';
+    \$config['enable_spellcheck'] = true;
+    \$config['spellcheck_engine'] = 'pspell';
+    include(__DIR__ . '/config.docker.inc.php');
+    " > config/config.inc.php
+
+  elif ! grep -q "config.docker.inc.php" config/config.inc.php; then
+    echo "include(__DIR__ . '/config.docker.inc.php');" >> config/config.inc.php
+  fi
+
+  ROUNDCUBEMAIL_PLUGINS_PHP=`echo "${ROUNDCUBEMAIL_PLUGINS}" | sed -E "s/[, ]+/', '/g"`
+  echo "Write Docker config to $PWD/config/config.docker.inc.php"
+  echo "<?php
+  \$config['db_dsnw'] = '${ROUNDCUBEMAIL_DSNW}';
+  \$config['db_dsnr'] = '${ROUNDCUBEMAIL_DSNR}';
+  \$config['default_host'] = '${ROUNDCUBEMAIL_DEFAULT_HOST}';
+  \$config['default_port'] = '${ROUNDCUBEMAIL_DEFAULT_PORT}';
+  \$config['smtp_server'] = '${ROUNDCUBEMAIL_SMTP_SERVER}';
+  \$config['smtp_port'] = '${ROUNDCUBEMAIL_SMTP_PORT}';
+  \$config['temp_dir'] = '${ROUNDCUBEMAIL_TEMP_DIR}';
+  \$config['skin'] = '${ROUNDCUBEMAIL_SKIN}';
+  \$config['plugins'] = array_filter(array_unique(array_merge(\$config['plugins'], ['${ROUNDCUBEMAIL_PLUGINS_PHP}'])));
+  " > config/config.docker.inc.php
+
+  if [ -e /run/secrets/roundcube_des_key ]; then
+    echo "\$config['des_key'] = file_get_contents('/run/secrets/roundcube_des_key');" >> config/config.docker.inc.php
+  elif [ ! -z "${ROUNDCUBEMAIL_DES_KEY}" ]; then
+    echo "\$config['des_key'] = getenv('ROUNDCUBEMAIL_DES_KEY');" >> config/config.docker.inc.php
+  fi
+
+  if [ ! -z "${ROUNDCUBEMAIL_SPELLCHECK_URI}"]; then
+    echo "\$config['spellcheck_engine'] = 'googie';" >> config/config.docker.inc.php
+    echo "\$config['spellcheck_uri'] = '${ROUNDCUBEMAIL_SPELLCHECK_URI}';" >> config/config.docker.inc.php
+  fi
+
+  # include custom config files
+  for fn in `ls /var/roundcube/config/*.php 2>/dev/null || true`; do
+    echo "include('$fn');" >> config/config.docker.inc.php
+  done
+
+  # initialize or update DB
+  bin/initdb.sh --dir=$PWD/SQL --update || echo "Failed to initialize/update the database. Please start with an empty database and restart the container."
+
+  if [ ! -z "${ROUNDCUBEMAIL_TEMP_DIR}" ]; then
+    mkdir -p ${ROUNDCUBEMAIL_TEMP_DIR} && chown www-data ${ROUNDCUBEMAIL_TEMP_DIR}
+  fi
+
+  if [ ! -z "${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" ]; then
+    echo "upload_max_filesize=${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" >> /usr/local/etc/php/conf.d/roundcube-override.ini
+    echo "post_max_size=${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" >> /usr/local/etc/php/conf.d/roundcube-override.ini
+  fi
+
+  : "${ROUNDCUBEMAIL_LOCALE:=en_US.UTF-8 UTF-8}"
+
+  if [ -e /usr/sbin/locale-gen ] && [ ! -z "${ROUNDCUBEMAIL_LOCALE}" ]; then
+    echo "${ROUNDCUBEMAIL_LOCALE}" > /etc/locale.gen
+    /usr/sbin/locale-gen
+  fi
+
+  if [ ! -z "${ROUNDCUBEMAIL_ASPELL_DICTS}" ]; then
+    ASPELL_PACKAGES=`echo -n "aspell-${ROUNDCUBEMAIL_ASPELL_DICTS}" | sed -E "s/[, ]+/ aspell-/g"`
+    which apt-get && apt-get install -y $ASPELL_PACKAGES
+    which apk && apk add --no-cache $ASPELL_PACKAGES
+  fi
+
+fi
+
+exec "$@"
diff --git a/fpm-alpine-1.5.x/php.ini b/fpm-alpine-1.5.x/php.ini
new file mode 100644 (file)
index 0000000..7b2147d
--- /dev/null
@@ -0,0 +1,10 @@
+memory_limit=64M
+display_errors=Off
+log_errors=On
+upload_max_filesize=5M
+post_max_size=6M
+zlib.output_compression=Off
+session.auto_start=Off
+session.gc_maxlifetime=21600
+session.gc_divisor=500
+session.gc_probability=1
git clone https://git.99rst.org/PROJECT