From: William Desportes Date: Sun, 19 May 2024 20:23:14 +0000 (+0200) Subject: Add new ENV ROUNDCUBEMAIL_INSTALL_PLUGINS (#245) X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=667818ca9a24023f79f339d5ba704552b19bc6de;p=roundcube-roundcubemail-docker.git Add new ENV ROUNDCUBEMAIL_INSTALL_PLUGINS (#245) * Added ROUNDCUBEMAIL_INSTALL_PLUGINS for installing plugins * Re-work the composer install plugins to use the way document on the README * Update the README * Transform into a space to avoid crashes * Fix displaying the plugin list --------- Co-authored-by: Mikkel Bundgaard --- diff --git a/README.md b/README.md index 18f1818..ec5a50c 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ The following env variables can be set to configure your Roundcube Docker instan `ROUNDCUBEMAIL_PLUGINS` - List of built-in plugins to activate. Defaults to `archive,zipdownload` +`ROUNDCUBEMAIL_INSTALL_PLUGINS` - Set to `1` or `true` to enable installation of plugins on startup + `ROUNDCUBEMAIL_SKIN` - Configures the default theme. Defaults to `larry` `ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE` - File upload size limit; defaults to `5M` @@ -123,16 +125,8 @@ For example, it may be used to increase the PHP memory limit (`memory_limit=128M ## Installing Roundcube Plugins -With the latest updates, the Roundcube images contain the [Composer](https://getcomposer.org) binary -which is used to install plugins. You can add and activate plugins by executing `composer require ` -inside a running Roundcube container: - -```sh -docker exec -it roundcubemail composer require johndoh/contextmenu --update-no-dev -``` - -If you have mounted the container's volume `/var/www/html` the plugins installed persist on your host system. -Otherwise they need to be (re-)installed every time you update or restart the Roundcube container. +With the latest updates, the Roundcube image is now able to install plugins. +You need to use `ROUNDCUBEMAIL_INSTALL_PLUGINS=1` in the env variables. ## Examples @@ -151,7 +145,7 @@ docker build -t roundcubemail . You can also create your own Docker image by extending from this image. -For instance, you could extend this image to add composer and install requirements for builtin plugins or even external plugins: +For instance, you could extend this image to add composer and install requirements for special plugins: ```Dockerfile FROM roundcube/roundcubemail:latest @@ -164,15 +158,4 @@ RUN set -ex; \ apt-get install -y --no-install-recommends \ git \ ; \ - \ - composer \ - --working-dir=/usr/src/roundcubemail/ \ - --prefer-dist \ - --prefer-stable \ - --update-no-dev \ - --no-interaction \ - --optimize-autoloader \ - require \ - johndoh/contextmenu \ - ; \ ``` diff --git a/apache/docker-entrypoint.sh b/apache/docker-entrypoint.sh index 0ffdc1d..4ea2ff2 100755 --- a/apache/docker-entrypoint.sh +++ b/apache/docker-entrypoint.sh @@ -75,6 +75,25 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}" : "${ROUNDCUBEMAIL_REQUEST_PATH:=/}" + if [ ! -z "${ROUNDCUBEMAIL_INSTALL_PLUGINS}" ]; then + echo "Installing plugins from the list" + echo "Plugins: ${ROUNDCUBEMAIL_PLUGINS}" + + # Change ',' into a space + ROUNDCUBEMAIL_PLUGINS_SH=`echo "${ROUNDCUBEMAIL_PLUGINS}" | tr ',' ' '` + + composer \ + --working-dir=/usr/src/roundcubemail/ \ + --prefer-dist \ + --prefer-stable \ + --update-no-dev \ + --no-interaction \ + --optimize-autoloader \ + require \ + -- \ + ${ROUNDCUBEMAIL_PLUGINS_SH}; + fi + if [ ! -e config/config.inc.php ]; then GENERATED_DES_KEY=`head /dev/urandom | base64 | head -c 24` touch config/config.inc.php diff --git a/fpm-alpine/docker-entrypoint.sh b/fpm-alpine/docker-entrypoint.sh index 0ffdc1d..4ea2ff2 100755 --- a/fpm-alpine/docker-entrypoint.sh +++ b/fpm-alpine/docker-entrypoint.sh @@ -75,6 +75,25 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}" : "${ROUNDCUBEMAIL_REQUEST_PATH:=/}" + if [ ! -z "${ROUNDCUBEMAIL_INSTALL_PLUGINS}" ]; then + echo "Installing plugins from the list" + echo "Plugins: ${ROUNDCUBEMAIL_PLUGINS}" + + # Change ',' into a space + ROUNDCUBEMAIL_PLUGINS_SH=`echo "${ROUNDCUBEMAIL_PLUGINS}" | tr ',' ' '` + + composer \ + --working-dir=/usr/src/roundcubemail/ \ + --prefer-dist \ + --prefer-stable \ + --update-no-dev \ + --no-interaction \ + --optimize-autoloader \ + require \ + -- \ + ${ROUNDCUBEMAIL_PLUGINS_SH}; + fi + if [ ! -e config/config.inc.php ]; then GENERATED_DES_KEY=`head /dev/urandom | base64 | head -c 24` touch config/config.inc.php diff --git a/fpm/docker-entrypoint.sh b/fpm/docker-entrypoint.sh index 0ffdc1d..4ea2ff2 100755 --- a/fpm/docker-entrypoint.sh +++ b/fpm/docker-entrypoint.sh @@ -75,6 +75,25 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}" : "${ROUNDCUBEMAIL_REQUEST_PATH:=/}" + if [ ! -z "${ROUNDCUBEMAIL_INSTALL_PLUGINS}" ]; then + echo "Installing plugins from the list" + echo "Plugins: ${ROUNDCUBEMAIL_PLUGINS}" + + # Change ',' into a space + ROUNDCUBEMAIL_PLUGINS_SH=`echo "${ROUNDCUBEMAIL_PLUGINS}" | tr ',' ' '` + + composer \ + --working-dir=/usr/src/roundcubemail/ \ + --prefer-dist \ + --prefer-stable \ + --update-no-dev \ + --no-interaction \ + --optimize-autoloader \ + require \ + -- \ + ${ROUNDCUBEMAIL_PLUGINS_SH}; + fi + if [ ! -e config/config.inc.php ]; then GENERATED_DES_KEY=`head /dev/urandom | base64 | head -c 24` touch config/config.inc.php diff --git a/templates/docker-entrypoint.sh b/templates/docker-entrypoint.sh index 0ffdc1d..4ea2ff2 100644 --- a/templates/docker-entrypoint.sh +++ b/templates/docker-entrypoint.sh @@ -75,6 +75,25 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}" : "${ROUNDCUBEMAIL_REQUEST_PATH:=/}" + if [ ! -z "${ROUNDCUBEMAIL_INSTALL_PLUGINS}" ]; then + echo "Installing plugins from the list" + echo "Plugins: ${ROUNDCUBEMAIL_PLUGINS}" + + # Change ',' into a space + ROUNDCUBEMAIL_PLUGINS_SH=`echo "${ROUNDCUBEMAIL_PLUGINS}" | tr ',' ' '` + + composer \ + --working-dir=/usr/src/roundcubemail/ \ + --prefer-dist \ + --prefer-stable \ + --update-no-dev \ + --no-interaction \ + --optimize-autoloader \ + require \ + -- \ + ${ROUNDCUBEMAIL_PLUGINS_SH}; + fi + if [ ! -e config/config.inc.php ]; then GENERATED_DES_KEY=`head /dev/urandom | base64 | head -c 24` touch config/config.inc.php