From: Thomas Bruederli Date: Tue, 19 Oct 2021 20:24:35 +0000 (+0200) Subject: Use local aspell/pspell as default spell check engine X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=b3292221e874ec9cfd24064081fa8b18a06b2128;p=roundcube-roundcubemail-docker.git Use local aspell/pspell as default spell check engine Install additional aspell dicts specified with ROUNDCUBEMAIL_ASPELL_DICTS on container start. Introduce ROUNDCUBEMAIL_SPELLCHECK_URI env var to use remote spell check API. --- diff --git a/README.md b/README.md index 9491c81..87e819c 100644 --- 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. diff --git a/apache/Dockerfile b/apache/Dockerfile index 5b7613e..52556c5 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -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/* diff --git a/apache/docker-entrypoint.sh b/apache/docker-entrypoint.sh index a476dc5..38c1a77 100755 --- a/apache/docker-entrypoint.sh +++ b/apache/docker-entrypoint.sh @@ -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 "$@" diff --git a/fpm-alpine/Dockerfile b/fpm-alpine/Dockerfile index 6e909f8..a8af5b2 100644 --- a/fpm-alpine/Dockerfile +++ b/fpm-alpine/Dockerfile @@ -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; \ diff --git a/fpm-alpine/docker-entrypoint.sh b/fpm-alpine/docker-entrypoint.sh index a476dc5..38c1a77 100755 --- a/fpm-alpine/docker-entrypoint.sh +++ b/fpm-alpine/docker-entrypoint.sh @@ -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 "$@" diff --git a/fpm/Dockerfile b/fpm/Dockerfile index 7a02197..260dd0e 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -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/* diff --git a/fpm/docker-entrypoint.sh b/fpm/docker-entrypoint.sh index a476dc5..38c1a77 100755 --- a/fpm/docker-entrypoint.sh +++ b/fpm/docker-entrypoint.sh @@ -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 "$@" diff --git a/templates/Dockerfile-alpine.templ b/templates/Dockerfile-alpine.templ index 0918b60..aad9196 100644 --- a/templates/Dockerfile-alpine.templ +++ b/templates/Dockerfile-alpine.templ @@ -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; \ diff --git a/templates/Dockerfile-debian.templ b/templates/Dockerfile-debian.templ index 53e4dd9..7ac43e5 100644 --- a/templates/Dockerfile-debian.templ +++ b/templates/Dockerfile-debian.templ @@ -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/* diff --git a/templates/docker-entrypoint.sh b/templates/docker-entrypoint.sh index a476dc5..38c1a77 100644 --- a/templates/docker-entrypoint.sh +++ b/templates/docker-entrypoint.sh @@ -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 "$@"