From 5bb3e13a1000609377fc8121c1410ad0ce07708d Mon Sep 17 00:00:00 2001 From: Carlos Mogas da Silva Date: Mon, 30 Apr 2018 17:49:15 +0100 Subject: [PATCH] Initial import --- .drone.yml | 8 ++++++++ Dockerfile | 22 ++++++++++++++++++++++ README.md | 24 ++++++++++++++++++++++++ docker-entrypoint.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 docker-entrypoint.sh diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..172973c --- /dev/null +++ b/.drone.yml @@ -0,0 +1,8 @@ +pipeline: + publish: + image: plugins/docker + repo: r3pek/roundcube + secrets: [ docker_username, docker_password ] + when: + branch: master + event: push diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..673e0cf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM instrumentisto/roundcube + +COPY docker-entrypoint.sh /docker-entrypoint.sh + +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + git \ + gnupg \ + libxml2-dev \ + && docker-php-ext-configure soap --with-libdir=lib/x86_64-linux-gnu \ + && docker-php-ext-install soap \ + && curl -fL -o /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl -fL -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { echo 'Invalid installer' . PHP_EOL; exit(1); }" \ + && php /tmp/composer-setup.php --install-dir=/tmp --filename=composer \ + && chmod +x /docker-entrypoint.sh \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false libxml2-dev \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir /plugins_config + +VOLUME ["plugins_config"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..63da47d --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Roundcube Image + +![ ](https://drone.r3pek.org/api/badges/r3pek/docker-roundcube/status.svg "Build Status") ![ ](https://img.shields.io/docker/pulls/r3pek/roundcube.svg "Docker Pulls") ![ ](https://img.shields.io/docker/stars/r3pek/roundcube.svg "Docker Stars") + +This image is derived from the [Instrumentisto Roundcube Image](https://hub.docker.com/r/instrumentisto/roundcube/) + +It works in everything like the parent image, being the main difference that you can add plugins to be installed at boot time in the file */app/composer.json*. +Basically, what I do, is to create a *Docker Config* with the composer.json content and mount it on the unformentioned directory. Something like this: + + configs: + - source: composer + target: /app/composer.json + +This way, you can install the plugins you want for your Roundcube instalation. Don't forget to also mount the config files if the plugins you install need them. + +# Quick Reference +* Where to file issues / suggestions +https://code.r3pek.org/r3pek/docker-roundcube/issues + +* Maintained by +[r3pek](https://code.r3pek.org/r3pek/) + +* Source repository +https://code.r3pek.org/r3pek/docker-roundcube/ diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..3d5688d --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,42 @@ +#!/bin/bash + + +logMsg() { + echo "["`date +%d'-'%b'-'%Y' '%H':'%M':'%S`"] $1" >> /proc/self/fd/2 +} + + +rm -f /usr/local/etc/php/conf.d/zz-opcache-revalidation.ini +if [ "$PHP_OPCACHE_REVALIDATION" == "1" ]; then + echo "opcache.validate_timestamps = On" \ + > /usr/local/etc/php/conf.d/zz-opcache-revalidation.ini + logMsg "STARTUP: PHP OPcache revalidation is enabled" +fi + + +appDir=/app +if [ "$SHARE_APP" == "1" ]; then + mkdir -p /shared + cp -rf /app/* /app/.htaccess /shared/ + chown -R www-data:www-data /shared/* /shared/.htaccess + appDir=/shared +fi +rm -f /var/www +ln -s $appDir /var/www +chown -R www-data:www-data /var/www + +cd /app +/tmp/composer update --no-dev --optimize-autoloader --no-progress +/tmp/composer install --no-dev --optimize-autoloader --no-progress +cd .. + +# Copy the plugins' configs to the correct place +for i in `find /plugins_config/* -type f`; do + dir=$(dirname $i) + dir=${dir##*/} + file=${i##*/} + rm "/app/plugins/${dir}/${file}" + ln -s "/plugins_config/${dir}/${file}" "/app/plugins/${dir}/${file}" +done + +exec "$@"