Use local aspell/pspell as default spell check engine
authorThomas Bruederli <redacted>
Tue, 19 Oct 2021 20:24:35 +0000 (22:24 +0200)
committerThomas Bruederli <redacted>
Wed, 27 Oct 2021 20:33:01 +0000 (22:33 +0200)
Install additional aspell dicts specified with ROUNDCUBEMAIL_ASPELL_DICTS on container start.

Introduce ROUNDCUBEMAIL_SPELLCHECK_URI env var to use remote spell check API.

README.md
apache/Dockerfile
apache/docker-entrypoint.sh
fpm-alpine/Dockerfile
fpm-alpine/docker-entrypoint.sh
fpm/Dockerfile
fpm/docker-entrypoint.sh
templates/Dockerfile-alpine.templ
templates/Dockerfile-debian.templ
templates/docker-entrypoint.sh

index 9491c81a098a5c391fb22a96541e1d8ad8c39437..87e819cb452888264278f2b475a2793ed23597fc 100644 (file)
--- a/README.md
+++ b/README.md
@@ -38,6 +38,10 @@ The following env variables can be set to configure your Roundcube Docker instan
 
 `ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE` - File upload size limit; defaults to `5M`
 
+`ROUNDCUBEMAIL_SPELLCHECK_URI` - Fully qualified URL to a Google XML spell check API like [google-spell-pspell](https://github.com/roundcube/google-spell-pspell)
+
+`ROUNDCUBEMAIL_ASPELL_DICTS` - List of aspell dictionaries to install for spell checking (comma-separated, e.g. `de,fr,pl`). 
+
 By default, the image will use a local SQLite database for storing user account metadata.
 It'll be created inside the `/var/roundcube/db` directory and can be backed up from there. Please note that
 this option should not be used for production environments.
index 5b7613ec57469c163450d4bbf4cf9d4d3c102a96..52556c537ff68f688e0543bc55bd72e656dbfb2a 100644 (file)
@@ -16,6 +16,8 @@ RUN set -ex; \
                libpq-dev \
                libsqlite3-dev \
                libzip-dev \
+               libpspell-dev \
+               libonig-dev \
        ; \
        \
        debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
@@ -30,6 +32,7 @@ RUN set -ex; \
                pdo_pgsql \
                pdo_sqlite \
                zip \
+               pspell \
        ; \
        pecl install imagick; \
        docker-php-ext-enable imagick opcache; \
@@ -53,6 +56,8 @@ RUN set -ex; \
        \
        apt-get update; \
        apt-get install -y --no-install-recommends \
+                       aspell \
+                       aspell-en \
                        rsync \
        ; \
        rm -rf /var/lib/apt/lists/*
index a476dc51ea87c8ee8952f0c7c60c09e52d31220d..38c1a77b21b44f0a853867d64e2a39af039b926d 100755 (executable)
@@ -68,7 +68,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
   : "${ROUNDCUBEMAIL_SMTP_SERVER:=localhost}"
   : "${ROUNDCUBEMAIL_SMTP_PORT:=587}"
   : "${ROUNDCUBEMAIL_PLUGINS:=archive,zipdownload}"
-  : "${ROUNDCUBEMAIL_SKIN:=larry}"
+  : "${ROUNDCUBEMAIL_SKIN:=elastic}"
   : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}"
 
   if [ ! -e config/config.inc.php ]; then
@@ -81,6 +81,8 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
     \$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
 
@@ -108,6 +110,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; 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
@@ -131,6 +138,13 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; 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 "$@"
index 6e909f8c5c792a80586fe69f6d1f189415137ba1..a8af5b22ad104b6ea2076720ae7e9223e62472a3 100644 (file)
@@ -8,7 +8,9 @@ RUN set -ex; \
                bash \
                coreutils \
                rsync \
-               tzdata
+               tzdata \
+               aspell \
+               aspell-en
 
 RUN set -ex; \
        \
@@ -23,6 +25,7 @@ RUN set -ex; \
                openldap-dev \
                postgresql-dev \
                sqlite-dev \
+               aspell-dev \
        ; \
        \
        docker-php-ext-configure gd; \
@@ -36,6 +39,7 @@ RUN set -ex; \
                pdo_pgsql \
                pdo_sqlite \
                zip \
+               pspell \
        ; \
        pecl install imagick; \
        docker-php-ext-enable imagick opcache; \
index a476dc51ea87c8ee8952f0c7c60c09e52d31220d..38c1a77b21b44f0a853867d64e2a39af039b926d 100755 (executable)
@@ -68,7 +68,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
   : "${ROUNDCUBEMAIL_SMTP_SERVER:=localhost}"
   : "${ROUNDCUBEMAIL_SMTP_PORT:=587}"
   : "${ROUNDCUBEMAIL_PLUGINS:=archive,zipdownload}"
-  : "${ROUNDCUBEMAIL_SKIN:=larry}"
+  : "${ROUNDCUBEMAIL_SKIN:=elastic}"
   : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}"
 
   if [ ! -e config/config.inc.php ]; then
@@ -81,6 +81,8 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
     \$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
 
@@ -108,6 +110,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; 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
@@ -131,6 +138,13 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; 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 "$@"
index 7a021974b5a2a0b4b5a3319c3c1f7aa9d2995e26..260dd0e2a6cd7fe7b0a1b88af02564606b44052f 100644 (file)
@@ -16,6 +16,8 @@ RUN set -ex; \
                libpq-dev \
                libsqlite3-dev \
                libzip-dev \
+               libpspell-dev \
+               libonig-dev \
        ; \
        \
        debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
@@ -30,6 +32,7 @@ RUN set -ex; \
                pdo_pgsql \
                pdo_sqlite \
                zip \
+               pspell \
        ; \
        pecl install imagick; \
        docker-php-ext-enable imagick opcache; \
@@ -53,6 +56,8 @@ RUN set -ex; \
        \
        apt-get update; \
        apt-get install -y --no-install-recommends \
+                       aspell \
+                       aspell-en \
                        rsync \
        ; \
        rm -rf /var/lib/apt/lists/*
index a476dc51ea87c8ee8952f0c7c60c09e52d31220d..38c1a77b21b44f0a853867d64e2a39af039b926d 100755 (executable)
@@ -68,7 +68,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
   : "${ROUNDCUBEMAIL_SMTP_SERVER:=localhost}"
   : "${ROUNDCUBEMAIL_SMTP_PORT:=587}"
   : "${ROUNDCUBEMAIL_PLUGINS:=archive,zipdownload}"
-  : "${ROUNDCUBEMAIL_SKIN:=larry}"
+  : "${ROUNDCUBEMAIL_SKIN:=elastic}"
   : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}"
 
   if [ ! -e config/config.inc.php ]; then
@@ -81,6 +81,8 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
     \$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
 
@@ -108,6 +110,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; 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
@@ -131,6 +138,13 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; 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 "$@"
index 0918b607b9e01c44a870c97bb793c264755df3e7..aad91962476cd432692912554207ee2f6469a20d 100644 (file)
@@ -8,7 +8,9 @@ RUN set -ex; \
                bash \
                coreutils \
                rsync \
-               tzdata
+               tzdata \
+               aspell \
+               aspell-en
 
 RUN set -ex; \
        \
@@ -23,6 +25,7 @@ RUN set -ex; \
                openldap-dev \
                postgresql-dev \
                sqlite-dev \
+               aspell-dev \
        ; \
        \
        docker-php-ext-configure gd; \
@@ -36,6 +39,7 @@ RUN set -ex; \
                pdo_pgsql \
                pdo_sqlite \
                zip \
+               pspell \
        ; \
        pecl install imagick; \
        docker-php-ext-enable imagick opcache; \
index 53e4dd9ec162c0ab0e5853092d98585f001f0630..7ac43e54c8e0c8aa76fdd3b02bed5a51325bb312 100644 (file)
@@ -16,6 +16,8 @@ RUN set -ex; \
                libpq-dev \
                libsqlite3-dev \
                libzip-dev \
+               libpspell-dev \
+               libonig-dev \
        ; \
        \
        debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
@@ -30,6 +32,7 @@ RUN set -ex; \
                pdo_pgsql \
                pdo_sqlite \
                zip \
+               pspell \
        ; \
        pecl install imagick; \
        docker-php-ext-enable imagick opcache; \
@@ -53,6 +56,8 @@ RUN set -ex; \
        \
        apt-get update; \
        apt-get install -y --no-install-recommends \
+                       aspell \
+                       aspell-en \
                        rsync \
        ; \
        rm -rf /var/lib/apt/lists/*
index a476dc51ea87c8ee8952f0c7c60c09e52d31220d..38c1a77b21b44f0a853867d64e2a39af039b926d 100644 (file)
@@ -68,7 +68,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
   : "${ROUNDCUBEMAIL_SMTP_SERVER:=localhost}"
   : "${ROUNDCUBEMAIL_SMTP_PORT:=587}"
   : "${ROUNDCUBEMAIL_PLUGINS:=archive,zipdownload}"
-  : "${ROUNDCUBEMAIL_SKIN:=larry}"
+  : "${ROUNDCUBEMAIL_SKIN:=elastic}"
   : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}"
 
   if [ ! -e config/config.inc.php ]; then
@@ -81,6 +81,8 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
     \$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
 
@@ -108,6 +110,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; 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
@@ -131,6 +138,13 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; 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 "$@"
git clone https://git.99rst.org/PROJECT