diff --git a/Dockerfile b/Dockerfile index 223d63f..a989fb8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ LABEL description "Rainloop is a simple, modern & fast web-based client" \ ARG GPG_FINGERPRINT="3B79 7ECE 694F 3B7B 70F3 11A4 ED7C 49D9 87DA 4591" -ENV UID=991 GID=991 +ENV UID=991 GID=991 UPLOAD_MAX_SIZE=25M RUN echo "@community https://nl.alpinelinux.org/alpine/v3.6/community" >> /etc/apk/repositories \ && apk -U upgrade \ @@ -35,28 +35,19 @@ RUN echo "@community https://nl.alpinelinux.org/alpine/v3.6/community" >> /etc/a && wget -q https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip \ && wget -q https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip.asc \ && wget -q https://www.rainloop.net/repository/RainLoop.asc \ - && echo "Verifying authenticity of rainloop-community-latest.zip using GPG..." \ && gpg --import RainLoop.asc \ && FINGERPRINT="$(LANG=C gpg --verify rainloop-community-latest.zip.asc rainloop-community-latest.zip 2>&1 \ | sed -n "s#Primary key fingerprint: \(.*\)#\1#p")" \ && if [ -z "${FINGERPRINT}" ]; then echo "Warning! Invalid GPG signature!" && exit 1; fi \ && if [ "${FINGERPRINT}" != "${GPG_FINGERPRINT}" ]; then echo "Warning! Wrong GPG fingerprint!" && exit 1; fi \ - && echo "All seems good, now unzipping rainloop-community-latest.zip..." \ && mkdir /rainloop && unzip -q /tmp/rainloop-community-latest.zip -d /rainloop \ && find /rainloop -type d -exec chmod 755 {} \; \ && find /rainloop -type f -exec chmod 644 {} \; \ && apk del build-dependencies \ && rm -rf /tmp/* /var/cache/apk/* /root/.gnupg -COPY nginx.conf /etc/nginx/nginx.conf -COPY php-fpm.conf /etc/php7/php-fpm.conf -COPY s6.d /etc/s6.d -COPY run.sh /usr/local/bin/run.sh - -RUN chmod +x /usr/local/bin/run.sh /etc/s6.d/*/* /etc/s6.d/.s6-svscan/* - +COPY rootfs / +RUN chmod +x /usr/local/bin/run.sh /services/*/run /services/.s6-svscan/* VOLUME /rainloop/data - EXPOSE 8888 - CMD ["run.sh"] diff --git a/README.md b/README.md index a35a67c..86ae48b 100644 --- a/README.md +++ b/README.md @@ -28,43 +28,23 @@ Rainloop is a simple, modern & fast web-based client. More details on the [offic | -------- | ----------- | ---- | ------------- | | **UID** | rainloop user id | *optional* | 991 | **GID** | rainloop group id | *optional* | 991 +| **UPLOAD_MAX_SIZE** | Attachment size limit | *optional* | 25M -### Reverse proxy example with nginx +### Docker-compose.yml -https://github.com/hardware/mailserver/wiki/Reverse-proxy-configuration +```yml +# Full example : +# https://github.com/hardware/mailserver/blob/master/docker-compose.sample.yml -### Initial configuration - -https://github.com/hardware/mailserver/wiki/Rainloop-initial-configuration - -### Docker-compose - -#### Docker-compose.yml -``` rainloop: image: hardware/rainloop container_name: rainloop - links: - - mariadb:mariadb volumes: - /mnt/docker/rainloop:/rainloop/data - -# if using mariadb as contacts database : - -mariadb: - image: mariadb:10.1 - container_name: mariadb - volumes: - - /mnt/docker/mysql/db:/var/lib/mysql - environment: - - MYSQL_ROOT_PASSWORD=xxxxxxx - - MYSQL_DATABASE=rainloop - - MYSQL_USER=rainloop - - MYSQL_PASSWORD=xxxxxxx + depends_on: + - mailserver ``` -#### Run ! +#### How to setup -``` -docker-compose up -d -``` +https://github.com/hardware/mailserver/wiki/Rainloop-initial-configuration diff --git a/nginx.conf b/rootfs/etc/nginx/nginx.conf similarity index 97% rename from nginx.conf rename to rootfs/etc/nginx/nginx.conf index 8a42a38..686beef 100644 --- a/nginx.conf +++ b/rootfs/etc/nginx/nginx.conf @@ -56,7 +56,7 @@ http { root /rainloop; index index.php; charset utf-8; - client_max_body_size 50M; + client_max_body_size ; location ^~ /data { deny all; diff --git a/php-fpm.conf b/rootfs/etc/php7/php-fpm.conf similarity index 65% rename from php-fpm.conf rename to rootfs/etc/php7/php-fpm.conf index 21c43ac..c1f55da 100644 --- a/php-fpm.conf +++ b/rootfs/etc/php7/php-fpm.conf @@ -10,5 +10,5 @@ pm.min_spare_servers = 1 pm.max_spare_servers = 3 chdir = / php_admin_value[expose_php] = Off -php_admin_value[post_max_size] = 50M -php_admin_value[upload_max_filesize] = 50M +php_admin_value[post_max_size] = +php_admin_value[upload_max_filesize] = diff --git a/s6.d/.s6-svscan/finish b/rootfs/services/.s6-svscan/finish similarity index 100% rename from s6.d/.s6-svscan/finish rename to rootfs/services/.s6-svscan/finish diff --git a/s6.d/nginx/run b/rootfs/services/nginx/run similarity index 100% rename from s6.d/nginx/run rename to rootfs/services/nginx/run diff --git a/s6.d/php/run b/rootfs/services/php/run similarity index 100% rename from s6.d/php/run rename to rootfs/services/php/run diff --git a/rootfs/usr/local/bin/run.sh b/rootfs/usr/local/bin/run.sh new file mode 100644 index 0000000..08be234 --- /dev/null +++ b/rootfs/usr/local/bin/run.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Set attachment size limit +sed -i "s//$UPLOAD_MAX_SIZE/g" /etc/php7/php-fpm.conf /etc/nginx/nginx.conf + +# Fix permissions +chown -R $UID:$GID /rainloop /services /var/log /var/lib/nginx + +# RUN ! +exec su-exec $UID:$GID /bin/s6-svscan /services diff --git a/run.sh b/run.sh deleted file mode 100644 index 7363eb0..0000000 --- a/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -chown -R $UID:$GID /rainloop /etc/nginx /etc/php7 /var/log /var/lib/nginx /tmp /etc/s6.d -exec su-exec $UID:$GID /bin/s6-svscan /etc/s6.d