From 7b8e9f7c5ed4134240d65db79922295bc750e56b Mon Sep 17 00:00:00 2001 From: Hardware Date: Sat, 13 Jan 2018 14:57:15 +0100 Subject: [PATCH] update(): alpine 3.7 --- Dockerfile | 27 ++++++-- README.md | 1 - rootfs/etc/nginx/nginx.conf | 78 ++++++++++++++++++++++++ rootfs/etc/php7/php-fpm.conf | 14 +++++ rootfs/nginx/sites-enabled/rainloop.conf | 30 --------- rootfs/services/.s6-svscan/finish | 2 + rootfs/services/nginx/run | 2 + rootfs/services/php/run | 2 + rootfs/usr/local/bin/run.sh | 9 ++- 9 files changed, 125 insertions(+), 40 deletions(-) create mode 100644 rootfs/etc/nginx/nginx.conf create mode 100644 rootfs/etc/php7/php-fpm.conf delete mode 100644 rootfs/nginx/sites-enabled/rainloop.conf create mode 100644 rootfs/services/.s6-svscan/finish create mode 100644 rootfs/services/nginx/run create mode 100644 rootfs/services/php/run diff --git a/Dockerfile b/Dockerfile index 0733c96..72d1c46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,36 @@ -FROM wonderfall/nginx-php:7.1 +FROM alpine:3.7 LABEL description "Rainloop is a simple, modern & fast web-based client" \ maintainer="Hardware " ARG GPG_FINGERPRINT="3B79 7ECE 694F 3B7B 70F3 11A4 ED7C 49D9 87DA 4591" -ENV UID=991 GID=991 UPLOAD_MAX_SIZE=25M MEMORY_LIMIT=128M +ENV UID=991 GID=991 UPLOAD_MAX_SIZE=25M -RUN apk -U upgrade \ +RUN echo "@community https://nl.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories \ + && apk -U upgrade \ && apk add -t build-dependencies \ gnupg \ openssl \ wget \ + && apk add \ + ca-certificates \ + nginx \ + s6 \ + su-exec \ + php7-fpm@community \ + php7-curl@community \ + php7-iconv@community \ + php7-xml@community \ + php7-dom@community \ + php7-openssl@community \ + php7-json@community \ + php7-zlib@community \ + php7-pdo_mysql@community \ + php7-pdo_sqlite@community \ + php7-sqlite3@community \ + php7-ldap@community \ + php7-simplexml@community \ && cd /tmp \ && 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 \ @@ -28,7 +47,7 @@ RUN apk -U upgrade \ && rm -rf /tmp/* /var/cache/apk/* /root/.gnupg COPY rootfs / -RUN chmod +x /usr/local/bin/* /etc/s6.d/*/* /etc/s6.d/.s6-svscan/* +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 643450a..86ae48b 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ 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 -| **MEMORY_LIMIT** | Maximum amount of memory used by php | *optional* | 128M ### Docker-compose.yml diff --git a/rootfs/etc/nginx/nginx.conf b/rootfs/etc/nginx/nginx.conf new file mode 100644 index 0000000..686beef --- /dev/null +++ b/rootfs/etc/nginx/nginx.conf @@ -0,0 +1,78 @@ +worker_processes auto; +pid /tmp/nginx.pid; +daemon off; + +events { + worker_connections 1024; + use epoll; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + access_log off; + error_log /tmp/ngx_error.log error; + + sendfile on; + keepalive_timeout 15; + keepalive_disable msie6; + keepalive_requests 100; + tcp_nopush on; + tcp_nodelay on; + server_tokens off; + + fastcgi_temp_path /tmp/fastcgi 1 2; + client_body_temp_path /tmp/client_body 1 2; + proxy_temp_path /tmp/proxy 1 2; + uwsgi_temp_path /tmp/uwsgi 1 2; + scgi_temp_path /tmp/scgi 1 2; + + gzip on; + gzip_comp_level 5; + gzip_min_length 512; + gzip_buffers 4 8k; + gzip_proxied any; + gzip_vary on; + gzip_disable "msie6"; + gzip_types + text/css + text/javascript + text/xml + text/plain + text/x-component + application/javascript + application/x-javascript + application/json + application/xml + application/rss+xml + application/vnd.ms-fontobject + font/truetype + font/opentype + image/svg+xml; + + server { + listen 8888; + root /rainloop; + index index.php; + charset utf-8; + client_max_body_size ; + + location ^~ /data { + deny all; + } + + location / { + try_files $uri $uri/ index.php; + } + + location ~* \.php$ { + fastcgi_index index.php; + fastcgi_pass unix:/tmp/php-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include /etc/nginx/fastcgi_params; + } + + } + +} diff --git a/rootfs/etc/php7/php-fpm.conf b/rootfs/etc/php7/php-fpm.conf new file mode 100644 index 0000000..c1f55da --- /dev/null +++ b/rootfs/etc/php7/php-fpm.conf @@ -0,0 +1,14 @@ +[global] +daemonize = no + +[www] +listen = /tmp/php-fpm.sock +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +chdir = / +php_admin_value[expose_php] = Off +php_admin_value[post_max_size] = +php_admin_value[upload_max_filesize] = diff --git a/rootfs/nginx/sites-enabled/rainloop.conf b/rootfs/nginx/sites-enabled/rainloop.conf deleted file mode 100644 index 985980c..0000000 --- a/rootfs/nginx/sites-enabled/rainloop.conf +++ /dev/null @@ -1,30 +0,0 @@ -server { - - listen 8888; - root /rainloop; - index index.php; - charset utf-8; - - location ^~ /data { - deny all; - return 404; - } - - location / { - try_files $uri $uri/ index.php; - } - - location ~* \.php$ { - try_files $uri =404; - include /nginx/conf/fastcgi_params; - fastcgi_split_path_info ^(.+\.php)(/.*)$; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_index index.php; - fastcgi_pass unix:/php/run/php-fpm.sock; - fastcgi_intercept_errors on; - fastcgi_request_buffering off; - fastcgi_param REMOTE_ADDR $http_x_real_ip; - } - -} diff --git a/rootfs/services/.s6-svscan/finish b/rootfs/services/.s6-svscan/finish new file mode 100644 index 0000000..039e4d0 --- /dev/null +++ b/rootfs/services/.s6-svscan/finish @@ -0,0 +1,2 @@ +#!/bin/sh +exit 0 diff --git a/rootfs/services/nginx/run b/rootfs/services/nginx/run new file mode 100644 index 0000000..eaf8049 --- /dev/null +++ b/rootfs/services/nginx/run @@ -0,0 +1,2 @@ +#!/bin/sh +exec nginx diff --git a/rootfs/services/php/run b/rootfs/services/php/run new file mode 100644 index 0000000..e238021 --- /dev/null +++ b/rootfs/services/php/run @@ -0,0 +1,2 @@ +#!/bin/sh +exec php-fpm7 diff --git a/rootfs/usr/local/bin/run.sh b/rootfs/usr/local/bin/run.sh index 5d3abd5..765d1b6 100644 --- a/rootfs/usr/local/bin/run.sh +++ b/rootfs/usr/local/bin/run.sh @@ -1,11 +1,10 @@ #!/bin/sh -# Set attachment size and memory limit -sed -i -e "s//$UPLOAD_MAX_SIZE/g" /nginx/conf/nginx.conf /php/etc/php-fpm.conf \ - -e "s//$MEMORY_LIMIT/g" /php/etc/php-fpm.conf +# 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/data /etc/s6.d /nginx /php /var/log +chown -R $UID:$GID /rainloop/data /services /var/log /var/lib/nginx # RUN ! -exec su-exec $UID:$GID /bin/s6-svscan /etc/s6.d +exec su-exec $UID:$GID /bin/s6-svscan /services