From 94d9d894c333672696e528efedb88dff7f6747ba Mon Sep 17 00:00:00 2001 From: Hardware Date: Tue, 29 Aug 2017 22:25:00 +0200 Subject: [PATCH] refactor(): move to wonderfall/nginx-php (possible fix #10) --- 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, 40 insertions(+), 125 deletions(-) delete mode 100644 rootfs/etc/nginx/nginx.conf delete mode 100644 rootfs/etc/php7/php-fpm.conf create mode 100644 rootfs/nginx/sites-enabled/rainloop.conf delete mode 100644 rootfs/services/.s6-svscan/finish delete mode 100644 rootfs/services/nginx/run delete mode 100644 rootfs/services/php/run diff --git a/Dockerfile b/Dockerfile index a989fb8..0733c96 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,36 +1,17 @@ -FROM alpine:3.6 +FROM wonderfall/nginx-php:7.1 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 +ENV UID=991 GID=991 UPLOAD_MAX_SIZE=25M MEMORY_LIMIT=128M -RUN echo "@community https://nl.alpinelinux.org/alpine/v3.6/community" >> /etc/apk/repositories \ - && apk -U upgrade \ +RUN 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 \ @@ -47,7 +28,7 @@ RUN echo "@community https://nl.alpinelinux.org/alpine/v3.6/community" >> /etc/a && rm -rf /tmp/* /var/cache/apk/* /root/.gnupg COPY rootfs / -RUN chmod +x /usr/local/bin/run.sh /services/*/run /services/.s6-svscan/* +RUN chmod +x /usr/local/bin/* /etc/s6.d/*/* /etc/s6.d/.s6-svscan/* VOLUME /rainloop/data EXPOSE 8888 CMD ["run.sh"] diff --git a/README.md b/README.md index 86ae48b..643450a 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ 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 deleted file mode 100644 index 686beef..0000000 --- a/rootfs/etc/nginx/nginx.conf +++ /dev/null @@ -1,78 +0,0 @@ -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 deleted file mode 100644 index c1f55da..0000000 --- a/rootfs/etc/php7/php-fpm.conf +++ /dev/null @@ -1,14 +0,0 @@ -[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 new file mode 100644 index 0000000..985980c --- /dev/null +++ b/rootfs/nginx/sites-enabled/rainloop.conf @@ -0,0 +1,30 @@ +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 deleted file mode 100644 index 039e4d0..0000000 --- a/rootfs/services/.s6-svscan/finish +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 0 diff --git a/rootfs/services/nginx/run b/rootfs/services/nginx/run deleted file mode 100644 index eaf8049..0000000 --- a/rootfs/services/nginx/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec nginx diff --git a/rootfs/services/php/run b/rootfs/services/php/run deleted file mode 100644 index e238021..0000000 --- a/rootfs/services/php/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec php-fpm7 diff --git a/rootfs/usr/local/bin/run.sh b/rootfs/usr/local/bin/run.sh index 765d1b6..5d3abd5 100644 --- a/rootfs/usr/local/bin/run.sh +++ b/rootfs/usr/local/bin/run.sh @@ -1,10 +1,11 @@ #!/bin/sh -# Set attachment size limit -sed -i "s//$UPLOAD_MAX_SIZE/g" /etc/php7/php-fpm.conf /etc/nginx/nginx.conf +# 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 # Fix permissions -chown -R $UID:$GID /rainloop/data /services /var/log /var/lib/nginx +chown -R $UID:$GID /rainloop/data /etc/s6.d /nginx /php /var/log # RUN ! -exec su-exec $UID:$GID /bin/s6-svscan /services +exec su-exec $UID:$GID /bin/s6-svscan /etc/s6.d