initial version

This commit is contained in:
Mauro Torrez 2019-10-01 00:11:47 -03:00
parent d9e6fadaab
commit e95c04bf68
16 changed files with 169 additions and 695 deletions

53
.drone.yml Normal file
View File

@ -0,0 +1,53 @@
---
kind: pipeline
name: default
steps:
- name: build and publish image
image: plugins/docker
settings:
repo: eumau/roundcubemail
auto_tag: true
username:
from_secret: dockerhub_username
password:
from_secret: dockerhub_password
when:
branch:
- master
---
kind: pipeline
name: pull_request
steps:
- name: build image only
image: plugins/docker
settings:
repo: eumau/roundcubemail
auto_tag: true
dry_run: true
trigger:
event:
- pull_request
---
kind: pipeline
name: tags
steps:
- name: docker
image: plugins/docker
settings:
repo: eumau/roundcubemail
username:
from_secret: dockerhub_username
password:
from_secret: dockerhub_password
tags:
- ${DRONE_TAG}
trigger:
event:
- tag

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*~
\#*
.#*
*.bak

109
Dockerfile Normal file
View File

@ -0,0 +1,109 @@
ARG UNIT_VERSION=1.11.0
FROM eumau/nginx-unit:${UNIT_VERSION}-php7.3
RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends \
php-exif \
php-gd \
php-intl \
php-ldap \
# php-opcache \
php-mysql \
php-pgsql \
php-sqlite3 \
php-zip \
# php-imagick \
# php-xml \
# php-mbstring \
# php-curl \
;
ENV ROUNDCUBEMAIL_VERSION=1.3.10
# Download package and extract to web volume
RUN set -ex; \
fetchDeps="gnupg dirmngr"; \
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"; \
# ha.pool.sks-keyservers.net seems to be unreliable, use pgp.mit.edu as fallback
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys F3E4C04BB3DB5D4215C45F7F5AB2BAA141C4F7D5 || gpg --batch --keyserver pgp.mit.edu --recv-keys F3E4C04BB3DB5D4215C45F7F5AB2BAA141C4F7D5; \
gpg --batch --verify roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
tar -xf roundcubemail.tar.gz -C /usr/src/; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
# upstream tarballs include ./roundcubemail-${ROUNDCUBEMAIL_VERSION}/ so this gives us /usr/src/roundcubemail-${ROUNDCUBEMAIL_VERSION}
mv /usr/src/roundcubemail-${ROUNDCUBEMAIL_VERSION} /usr/src/roundcubemail; \
rm -rf /usr/src/roundcubemail/installer
# 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 /etc/php/7.3/embed/conf.d/roundcube-defaults.ini
COPY docker-entrypoint.sh /
# expose these volumes
VOLUME /var/roundcube/config
VOLUME /var/www/html
VOLUME /tmp/roundcube-temp
# launch and configure Unit
RUN \
[ -f /var/www/html/index.php ] || { \
touch /var/www/html/index.php /var/www/html/index.php.remove; \
} \
&& unitd --control unix:/var/run/control.unit.sock \
&& curl -X PUT --data-binary \
'{ \
"listeners": { "*:9000": { "pass": "routes" } }, \
"routes": [ \
{ "match": { "uri": "/console.php" }, "action": { "pass": "applications/direct_php" } }, \
{ "match": { "uri": "/cron.php" }, "action": { "pass": "applications/direct_php" } }, \
{ "match": { "uri": "/index.php" }, "action": { "pass": "applications/direct_php" } }, \
{ "match": { "uri": "/public.php" }, "action": { "pass": "applications/direct_php" } }, \
{ "match": { "uri": "/remote.php" }, "action": { "pass": "applications/direct_php" } }, \
{ "match": { "uri": "/status.php" }, "action": { "pass": "applications/direct_php" } }, \
{ "match": { "uri": "/version.php" }, "action": { "pass": "applications/direct_php" } }, \
{ "match": { "uri": "/core/img/*" }, "action": { "share": "/var/www/html" } }, \
{ "match": { "uri": "/core/css/*" }, "action": { "share": "/var/www/html" } }, \
{ "match": { "uri": "/core/fonts/*" }, "action": { "share": "/var/www/html" } }, \
{ "match": { "uri": "/core/js/*" }, "action": { "share": "/var/www/html" } }, \
{ "match": { "uri": "/themes/*" }, "action": { "share": "/var/www/html" } }, \
{ "action": { "pass": "applications/index_php" } } \
], \
"applications": { \
"index_php": { \
"type": "php", \
"processes": { "max": 20, "spare": 5 }, \
"user": "www-data", \
"group": "www-data", \
"root": "/var/www/html", \
"script": "index.php" \
}, \
"direct_php": { \
"type": "php", \
"processes": { "max": 5, "spare": 0 }, \
"user": "www-data", \
"group": "www-data", \
"root": "/var/www/html", \
"index": "index.php" \
} \
} \
}' \
--unix-socket /var/run/control.unit.sock http://localhost/config/ \
&& [ -f /var/www/html/index.php.remove ] && { \
rm /var/www/html/index.php /var/www/html/index.php.remove; \
}
WORKDIR /var/www/html
EXPOSE 9000
ENTRYPOINT ["/docker-entrypoint.sh"]
STOPSIGNAL SIGTERM
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]

View File

@ -1,88 +0,0 @@
FROM php:7.2-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 \
libpng-dev \
libpq-dev \
libsqlite3-dev \
zlib1g-dev \
; \
\
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
docker-php-ext-install \
exif \
gd \
intl \
ldap \
pdo_mysql \
pdo_pgsql \
pdo_sqlite \
zip \
; \
\
# 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/*
# enable mod_rewrite
RUN a2enmod rewrite
# expose these volumes
VOLUME /var/roundcube/config
VOLUME /var/www/html
VOLUME /tmp/roundcube-temp
# Define Roundcubemail version
ENV ROUNDCUBEMAIL_VERSION 1.3.10
# Download package and extract to web volume
RUN set -ex; \
fetchDeps="gnupg dirmngr"; \
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"; \
# ha.pool.sks-keyservers.net seems to be unreliable, use pgp.mit.edu as fallback
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys F3E4C04BB3DB5D4215C45F7F5AB2BAA141C4F7D5 || gpg --batch --keyserver pgp.mit.edu --recv-keys F3E4C04BB3DB5D4215C45F7F5AB2BAA141C4F7D5; \
gpg --batch --verify roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
tar -xf roundcubemail.tar.gz -C /usr/src/; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
# upstream tarballs include ./roundcubemail-${ROUNDCUBEMAIL_VERSION}/ so this gives us /usr/src/roundcubemail-${ROUNDCUBEMAIL_VERSION}
mv /usr/src/roundcubemail-${ROUNDCUBEMAIL_VERSION} /usr/src/roundcubemail; \
rm -rf /usr/src/roundcubemail/installer
# 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 docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["apache2-foreground"]

View File

@ -1,81 +0,0 @@
version: "2"
services:
roundcube:
build: ./
container_name: roundcube
#restart: always
depends_on:
- roundcubedb
links:
- roundcubedb
ports:
- 80:80
volumes:
- /srv/roundcube/html:/var/www/html
environment:
- ROUNDCUBEMAIL_DB_TYPE=mysql
- ROUNDCUBEMAIL_DB_HOST=roundcubedb # same as mysql container name
- ROUNDCUBEMAIL_DB_NAME=roundcube # same as mysql MYSQL_DATABASE env name
- ROUNDCUBEMAIL_DB_USER=roundcube # same as mysql MYSQL_USER env name
- ROUNDCUBEMAIL_DB_PASSWORD=roundcubedbpass # same as mysql MYSQL_PASSWORD env name
roundcubedb:
image: mariadb:latest
container_name: roundcubedb
restart: always
command: --character_set_client=utf8 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --character-set-client-handshake=FALSE
ports:
- 3306:3306
volumes:
- /srv/roundcube/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=mysqlrootpassword
- MYSQL_DATABASE=roundcube
- MYSQL_USER=roundcube
- MYSQL_PASSWORD=roundcubedbpass
# Sample mail server to use with RoundCube: https://github.com/tomav/docker-mailserver
# mailserver:
# image: tvial/docker-mailserver:latest
# hostname: mail
# domainname: <YOUR.DOMAIN.NAME>
# container_name: mail
# restart: always
# ports:
# # receiving email from other mailservers
# - "25:25"
# # SSL & TLS Client email submission (SMTP)
# - "465:465"
# - "587:587"
# # StartTLS & TLS/SSL IMAP client
# - "143:143"
# - "993:993"
# # POP3 & TLS/SSL POP3 client
# - "110:110"
# - "995:995"
# # Manage Sieve port
# - "4190:4190"
# environment:
# - DMS_DEBUG=0
# - ONE_DIR=1
# - ENABLE_CLAMAV=1
# - ENABLE_FAIL2BAN=1
# - ENABLE_POSTGREY=1
# - ENABLE_MANAGESIEVE=1
# # If you need SSL connection, you can provide your own certificates
# #- SSL_TYPE=manual
# #- SSL_CERT_PATH=/etc/letsencrypt/fullchain.pem
# #- SSL_KEY_PATH=/etc/letsencrypt/privkey.pem
# cap_add:
# - NET_ADMIN
# - SYS_PTRACE
# volumes:
# - /srv/mail/data:/var/mail
# - /srv/mail/state:/var/mail-state
# # For proper delivery, generate DKIM keys in /srv/mail/setup
# - /srv/mail/setup:/tmp/docker-mailserver
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
# # If you need SSL connection, you can provide your own certificates
# # - ./certs:/etc/letsencrypt

View File

@ -1,109 +0,0 @@
#!/bin/bash
# set -ex
# PWD=`pwd`
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
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"
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/www/html/db
: "${ROUNDCUBEMAIL_DB_TYPE:=sqlite}"
: "${ROUNDCUBEMAIL_DB_DIR:=$PWD/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_TEMP_DIR:=/tmp/roundcube-temp}"
if [ ! -e config/config.inc.php ]; then
ROUNDCUBEMAIL_PLUGINS_PHP=`echo "${ROUNDCUBEMAIL_PLUGINS}" | sed -E "s/[, ]+/', '/g"`
ROUNDCUBEMAIL_DES_KEY=`test -f /run/secrets/roundcube_des_key && cat /run/secrets/roundcube_des_key || head /dev/urandom | base64 | head -c 24`
touch config/config.inc.php
echo "Write config to $PWD/config/config.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['smtp_user'] = '%u';
\$config['smtp_pass'] = '%p';
\$config['des_key'] = '${ROUNDCUBEMAIL_DES_KEY}';
\$config['temp_dir'] = '${ROUNDCUBEMAIL_TEMP_DIR}';
\$config['plugins'] = ['${ROUNDCUBEMAIL_PLUGINS_PHP}'];
\$config['zipdownload_selection'] = true;
\$config['log_driver'] = 'stdout';
" > config/config.inc.php
for fn in `ls /var/roundcube/config/*.php 2>/dev/null || true`; do
echo "include('$fn');" >> config/config.inc.php
done
# initialize DB if not SQLite
echo "${ROUNDCUBEMAIL_DSNW}" | grep -q 'sqlite:' || bin/initdb.sh --dir=$PWD/SQL || bin/updatedb.sh --dir=$PWD/SQL --package=roundcube || echo "Failed to initialize databse. Please run $PWD/bin/initdb.sh manually."
else
echo "WARNING: $PWD/config/config.inc.php already exists."
echo "ROUNDCUBEMAIL_* environment variables have been ignored."
fi
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
fi
exec "$@"

View File

@ -3,7 +3,7 @@
# PWD=`pwd`
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [[ "$1" == apache2* ]] || [ "$1" == unitd ]; then
if ! [ -e index.php -a -e bin/installto.sh ]; then
echo >&2 "roundcubemail not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then

View File

@ -1,83 +0,0 @@
FROM php:7.2-fpm-alpine
LABEL maintainer="Thomas Bruederli <thomas@roundcube.net>"
# entrypoint.sh and cron.sh dependencies
RUN set -ex; \
\
apk add --no-cache \
bash \
coreutils
RUN set -ex; \
\
apk add --no-cache --virtual .build-deps \
icu-dev \
libjpeg-turbo-dev \
libpng-dev \
openldap-dev \
postgresql-dev \
sqlite-dev \
; \
\
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-configure ldap; \
docker-php-ext-install \
exif \
gd \
intl \
ldap \
pdo_mysql \
pdo_pgsql \
pdo_sqlite \
zip \
; \
\
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 $runDeps; \
apk del .build-deps
# expose these volumes
VOLUME /var/roundcube/config
VOLUME /var/www/html
VOLUME /tmp/roundcube-temp
# Define Roundcubemail version
ENV ROUNDCUBEMAIL_VERSION 1.3.10
# 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"; \
# ha.pool.sks-keyservers.net seems to be unreliable, use pgp.mit.edu as fallback
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys F3E4C04BB3DB5D4215C45F7F5AB2BAA141C4F7D5 || gpg --batch --keyserver pgp.mit.edu --recv-keys F3E4C04BB3DB5D4215C45F7F5AB2BAA141C4F7D5; \
gpg --batch --verify roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
tar -xf roundcubemail.tar.gz -C /usr/src/; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
# upstream tarballs include ./roundcubemail-${ROUNDCUBEMAIL_VERSION}/ so this gives us /usr/src/roundcubemail-${ROUNDCUBEMAIL_VERSION}
mv /usr/src/roundcubemail-${ROUNDCUBEMAIL_VERSION} /usr/src/roundcubemail; \
rm -rf /usr/src/roundcubemail/installer; \
apk del .fetch-deps
# 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 docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["php-fpm"]

View File

@ -1,109 +0,0 @@
#!/bin/bash
# set -ex
# PWD=`pwd`
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
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"
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/www/html/db
: "${ROUNDCUBEMAIL_DB_TYPE:=sqlite}"
: "${ROUNDCUBEMAIL_DB_DIR:=$PWD/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_TEMP_DIR:=/tmp/roundcube-temp}"
if [ ! -e config/config.inc.php ]; then
ROUNDCUBEMAIL_PLUGINS_PHP=`echo "${ROUNDCUBEMAIL_PLUGINS}" | sed -E "s/[, ]+/', '/g"`
ROUNDCUBEMAIL_DES_KEY=`test -f /run/secrets/roundcube_des_key && cat /run/secrets/roundcube_des_key || head /dev/urandom | base64 | head -c 24`
touch config/config.inc.php
echo "Write config to $PWD/config/config.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['smtp_user'] = '%u';
\$config['smtp_pass'] = '%p';
\$config['des_key'] = '${ROUNDCUBEMAIL_DES_KEY}';
\$config['temp_dir'] = '${ROUNDCUBEMAIL_TEMP_DIR}';
\$config['plugins'] = ['${ROUNDCUBEMAIL_PLUGINS_PHP}'];
\$config['zipdownload_selection'] = true;
\$config['log_driver'] = 'stdout';
" > config/config.inc.php
for fn in `ls /var/roundcube/config/*.php 2>/dev/null || true`; do
echo "include('$fn');" >> config/config.inc.php
done
# initialize DB if not SQLite
echo "${ROUNDCUBEMAIL_DSNW}" | grep -q 'sqlite:' || bin/initdb.sh --dir=$PWD/SQL || bin/updatedb.sh --dir=$PWD/SQL --package=roundcube || echo "Failed to initialize databse. Please run $PWD/bin/initdb.sh manually."
else
echo "WARNING: $PWD/config/config.inc.php already exists."
echo "ROUNDCUBEMAIL_* environment variables have been ignored."
fi
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
fi
exec "$@"

View File

@ -1,10 +0,0 @@
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

View File

@ -1,86 +0,0 @@
FROM php:7.2-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 \
libpng-dev \
libpq-dev \
libsqlite3-dev \
zlib1g-dev \
; \
\
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
docker-php-ext-install \
exif \
gd \
intl \
ldap \
pdo_mysql \
pdo_pgsql \
pdo_sqlite \
zip \
; \
\
# 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/*
# expose these volumes
VOLUME /var/roundcube/config
VOLUME /var/www/html
VOLUME /tmp/roundcube-temp
# Define Roundcubemail version
ENV ROUNDCUBEMAIL_VERSION 1.3.10
# Download package and extract to web volume
RUN set -ex; \
fetchDeps="gnupg dirmngr"; \
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"; \
# ha.pool.sks-keyservers.net seems to be unreliable, use pgp.mit.edu as fallback
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys F3E4C04BB3DB5D4215C45F7F5AB2BAA141C4F7D5 || gpg --batch --keyserver pgp.mit.edu --recv-keys F3E4C04BB3DB5D4215C45F7F5AB2BAA141C4F7D5; \
gpg --batch --verify roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
tar -xf roundcubemail.tar.gz -C /usr/src/; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" roundcubemail.tar.gz.asc roundcubemail.tar.gz; \
# upstream tarballs include ./roundcubemail-${ROUNDCUBEMAIL_VERSION}/ so this gives us /usr/src/roundcubemail-${ROUNDCUBEMAIL_VERSION}
mv /usr/src/roundcubemail-${ROUNDCUBEMAIL_VERSION} /usr/src/roundcubemail; \
rm -rf /usr/src/roundcubemail/installer
# 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 docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["php-fpm"]

View File

@ -1,102 +0,0 @@
version: "2"
services:
roundcube:
build: ./
container_name: roundcube
#restart: always
depends_on:
- roundcubedb
links:
- roundcubedb
ports:
- 9000:9000
volumes:
- /srv/roundcube/html:/var/www/html
environment:
- ROUNDCUBEMAIL_DB_TYPE=pgsql
- ROUNDCUBEMAIL_DB_HOST=roundcubedb # same as pgsql container name
- ROUNDCUBEMAIL_DB_NAME=roundcube # same as pgsql POSTGRES_DB env name
- ROUNDCUBEMAIL_DB_USER=roundcube # same as pgsql POSTGRES_USER env name
- ROUNDCUBEMAIL_DB_PASSWORD=roundcube # same as pgsql POSTGRES_PASSWORD env name
roundcubedb:
image: postgres:latest
container_name: roundcubedb
restart: always
ports:
- 5432:5432
volumes:
- /srv/roundcube/db:/var/lib/postgresql/data
environment:
- POSTGRES_DB=roundcube
- POSTGRES_USER=roundcube
- POSTGRES_PASSWORD=roundcube
roundcubenginx:
image: nginx:latest
container_name: roundcubenginx
restart: always
ports:
- 80:80
# If you need SSL connection
# - '443:443'
depends_on:
- roundcube
links:
- roundcube
volumes:
- /srv/roundcube/html:/var/www/html
# TODO Provide a custom nginx conf
#- ./nginx.conf:/etc/nginx/nginx.conf:ro
# If you need SSL connection, you can provide your own certificates
# - ./certs:/etc/letsencrypt
# - ./certs-data:/data/letsencrypt
environment:
- NGINX_HOST=localhost # set your local domain or your live domain
# - NGINX_CGI=roundcube:9000 # same as roundcube container name
# Sample mail server to use with RoundCube: https://github.com/tomav/docker-mailserver
# mailserver:
# image: tvial/docker-mailserver:latest
# hostname: mail
# domainname: <YOUR.DOMAIN.NAME>
# container_name: mail
# restart: always
# ports:
# # receiving email from other mailservers
# - "25:25"
# # SSL & TLS Client email submission (SMTP)
# - "465:465"
# - "587:587"
# # StartTLS & TLS/SSL IMAP client
# - "143:143"
# - "993:993"
# # POP3 & TLS/SSL POP3 client
# - "110:110"
# - "995:995"
# # Manage Sieve port
# - "4190:4190"
# environment:
# - DMS_DEBUG=0
# - ONE_DIR=1
# - ENABLE_CLAMAV=1
# - ENABLE_FAIL2BAN=1
# - ENABLE_POSTGREY=1
# - ENABLE_MANAGESIEVE=1
# # If you need SSL connection, you can provide your own certificates
# #- SSL_TYPE=manual
# #- SSL_CERT_PATH=/etc/letsencrypt/fullchain.pem
# #- SSL_KEY_PATH=/etc/letsencrypt/privkey.pem
# cap_add:
# - NET_ADMIN
# - SYS_PTRACE
# volumes:
# - /srv/mail/data:/var/mail
# - /srv/mail/state:/var/mail-state
# # For proper delivery, generate DKIM keys in /srv/mail/setup
# - /srv/mail/setup:/tmp/docker-mailserver
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
# # If you need SSL connection, you can provide your own certificates
# # - ./certs:/etc/letsencrypt

View File

@ -1,10 +0,0 @@
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

View File

@ -1,14 +0,0 @@
#!/bin/bash
set -e
tagStart=$(echo $IMAGE_NAME | awk '{print index($1,":")}')
repoName=${IMAGE_NAME:0:tagStart-1}
tagName=${IMAGE_NAME:tagStart:99}
if [ "$tagName" = "latest-apache" ]; then
echo "Tagging $IMAGE_NAME as :latest"
docker tag $IMAGE_NAME ${repoName}:latest
docker push ${repoName}:latest
fi