diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..029bf8b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,54 @@ +# http://product_installation_URL/?admin +# Default login is "admin", password is "12345". +FROM alpine:3.3 +MAINTAINER Andrey Arapov + +# Install the dependencies +RUN apk update && \ + apk add wget unzip gnupg1 nginx php-fpm \ + php-curl php-json php-dom php-zlib php-iconv php-openssl + +# Create the application user so that PHP-FPM can run +ENV USER rainloop +ENV UID 7008 +ENV HOME /home/$USER +ENV DATA /opt/rainloop +RUN adduser -D -u $UID -h $HOME -s /bin/true $USER && \ + mkdir -p $DATA && \ + touch /var/log/php-fpm.log && \ + chown -Rh $USER:$USER $DATA /var/log/php-fpm.log + +# Prepare the environment so that nginx can run as non-root +RUN mkdir -p /var/log/rainloop /var/lib/nginx/tmp && \ + ( cd /var/lib/nginx/tmp && \ + for i in client_body proxy fastcgi uwsgi scgi; do mkdir $i; done ) && \ + ( cd /var/log/nginx && \ + touch error.log access.log ) && \ + touch /var/run/nginx.pid && \ + chown -Rh nginx:nginx /var/log/nginx /var/lib/nginx /var/run/nginx.pid /var/log/rainloop + +# Obtain the latest version of the RainLoop Webmail Community edition, +# verify its integrity using GnuPG and then decompress it +USER $USER +ENV RLFILE rainloop-community-latest.zip +ENV RLFILESIG rainloop-community-latest.zip.asc +ENV FINGERPRINT "3B797ECE694F3B7B70F311A4ED7C49D987DA4591" +WORKDIR $DATA +RUN wget -O $RLFILE http://repository.rainloop.net/v2/webmail/$RLFILE && \ + wget -O $RLFILESIG http://repository.rainloop.net/v2/webmail/$RLFILESIG && \ + export GNUPGHOME="$(mktemp -d)" && \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$FINGERPRINT" && \ + gpg --batch --verify $RLFILESIG $RLFILE && \ + unzip $RLFILE && \ + rm -rf "$GNUPGHOME" $RLFILE + +# Copy the nginx configs and then launch the PHP-FPM and Nginx +USER root +COPY rainloop.conf /etc/nginx/conf.d/rainloop.conf +COPY nginx.conf /etc/nginx/nginx.conf +CMD /bin/sh -c "find /var/lib/nginx/tmp > /dev/null; \ + su -s /bin/sh $USER -c php-fpm && \ + su -s /bin/sh nginx -c nginx" + +VOLUME [ "/opt/rainloop/data", "/var/log/rainloop" ] +EXPOSE 80/tcp diff --git a/README.md b/README.md new file mode 100644 index 0000000..3b952e0 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# RainLoop webmail client + +[RainLoop](http://www.rainloop.net/) is a Simple, modern & fast web-based email client. + + +## Run the container + +There are two ways of running the container, it could be either using the +Docker Compose or a classic docker command. + +**Docker Compose way** +``` +docker-compose up webmail +``` + +**Classic way** +``` +docker run -d --name webmail -p 80:8080/tcp -v rainloop_data:/opt/rainloop/data andrey01/rainloop +``` + +## Accessing the container + +First, access the RainLoop admin page in order to set the admin password, your +domains and configure the rest. + +The default user is **admin** and a password is **12345** + +**RainLoop admin page** +``` +http://hostip/?admin +``` + +## Stopping the container + +**Docker Compose way** +``` +docker-compose stop webmail +``` + +**Classic way** +``` +docker stop webmail +``` + +## Building the image + +If you wish, you can build the image by yourself. + +``` +docker build -t andrey01/rainloop . +``` + +## Additional notes + +The persistent data will be kept in the `rainloop_data` Docker's volume. +So before you delete it, keep in mind that you may want to [back it up](https://docs.docker.com/engine/userguide/containers/dockervolumes/#backup-restore-or-migrate-data-volumes) at the first. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..70cdaae --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '2' + +volumes: + rainloop_data: {} + +services: + webmail: + image: andrey01/rainloop + network_mode: bridge + ports: + - "80:8080/tcp" + volumes: + - rainloop_data:/opt/rainloop/data diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..bde1a96 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,24 @@ +daemon off; +error_log stderr info; +user nginx; +worker_processes 1; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + access_log /var/log/nginx/access.log main; + + sendfile on; + keepalive_timeout 65; + gzip on; + include conf.d/*.conf; +} diff --git a/rainloop.conf b/rainloop.conf new file mode 100644 index 0000000..8bd0477 --- /dev/null +++ b/rainloop.conf @@ -0,0 +1,37 @@ +server { + listen 8080 default_server; + server_name _; + + access_log /var/log/rainloop/access.log; + error_log /var/log/rainloop/error.log; + + large_client_header_buffers 4 32k; + client_max_body_size 50M; + charset utf-8; + + root /opt/rainloop; + index index.php; + + # deny access to .htaccess files + location ~ /\.ht { + deny all; + } + + # rainloop standard security + location ^~ /data { + deny all; + } + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + fastcgi_index index.php; + fastcgi_split_path_info ^(.+\.php)(.*)$; + fastcgi_keep_conn on; + include fastcgi_params; + fastcgi_pass 127.0.0.1:9000; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } +}