From 1269a34a119efc16cf5d1ad83ca41edcb45186e9 Mon Sep 17 00:00:00 2001 From: Wonderfall Date: Sat, 30 Jul 2016 18:57:58 +0200 Subject: [PATCH] nextcloud: fix pgsql, add 10beta, update readme --- nextcloud/10.0/Dockerfile | 65 ++++++++++++++++++++ nextcloud/10.0/apcu.ini | 4 ++ nextcloud/10.0/cron | 2 + nextcloud/10.0/nginx.conf | 105 ++++++++++++++++++++++++++++++++ nextcloud/10.0/opcache.ini | 8 +++ nextcloud/10.0/php-fpm.conf | 22 +++++++ nextcloud/10.0/run.sh | 23 +++++++ nextcloud/10.0/supervisord.conf | 11 ++++ nextcloud/9.0/Dockerfile | 3 +- nextcloud/README.md | 11 +--- nextcloud/daily/Dockerfile | 3 +- 11 files changed, 247 insertions(+), 10 deletions(-) create mode 100644 nextcloud/10.0/Dockerfile create mode 100644 nextcloud/10.0/apcu.ini create mode 100644 nextcloud/10.0/cron create mode 100644 nextcloud/10.0/nginx.conf create mode 100644 nextcloud/10.0/opcache.ini create mode 100644 nextcloud/10.0/php-fpm.conf create mode 100644 nextcloud/10.0/run.sh create mode 100644 nextcloud/10.0/supervisord.conf diff --git a/nextcloud/10.0/Dockerfile b/nextcloud/10.0/Dockerfile new file mode 100644 index 0000000..8d2ab6f --- /dev/null +++ b/nextcloud/10.0/Dockerfile @@ -0,0 +1,65 @@ +FROM alpine:3.4 +MAINTAINER Wonderfall + +ARG NEXTCLOUD_VERSION=10.0beta + +ENV GID=991 UID=991 + +RUN echo "@commuedge https://nl.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ + && echo "@testing https://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ + && BUILD_DEPS="tar" \ + && apk -U add \ + ${BUILD_DEPS} \ + nginx \ + supervisor \ + openssl \ + ca-certificates \ + tini@commuedge \ + php7@testing \ + php7-fpm@testing \ + php7-intl@testing \ + php7-mbstring@testing \ + php7-curl@testing \ + php7-gd@testing \ + php7-mcrypt@testing \ + php7-opcache@testing \ + php7-json@testing \ + php7-session@testing \ + php7-pdo@testing \ + php7-dom@testing \ + php7-ctype@testing \ + php7-iconv@testing \ + php7-pdo_mysql@testing \ + php7-pdo_pgsql@testing \ + php7-pgsql@testing \ + php7-zlib@testing \ + php7-zip@testing \ + php7-xmlreader@testing \ + php7-posix@testing \ + php7-openssl@testing \ + php7-ldap@testing \ + php7-apcu@testing \ + && mkdir /nextcloud && cd /tmp \ + && wget -q https://download.nextcloud.com/server/prereleases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2 \ + && tar xjf latest.tar.bz2 --strip 1 -C /nextcloud \ + && apk del ${BUILD_DEPS} \ + && rm -rf /var/cache/apk/* /tmp/* + +COPY nginx.conf /etc/nginx/nginx.conf +COPY php-fpm.conf /etc/php7/php-fpm.conf +COPY opcache.ini /etc/php7/conf.d/00_opcache.ini +COPY apcu.ini /etc/php7/conf.d/apcu.ini +COPY supervisord.conf /etc/supervisor/supervisord.conf +COPY run.sh /usr/local/bin/run.sh +COPY cron /etc/periodic/15min/nextcloud + +RUN chmod +x /usr/local/bin/run.sh /etc/periodic/15min/nextcloud + +VOLUME /data /config /apps2 + +EXPOSE 80 + +LABEL description="A server software for creating file hosting services" \ + nextcloud="Nextcloud daily build" + +CMD ["/sbin/tini","--","run.sh"] diff --git a/nextcloud/10.0/apcu.ini b/nextcloud/10.0/apcu.ini new file mode 100644 index 0000000..03f5011 --- /dev/null +++ b/nextcloud/10.0/apcu.ini @@ -0,0 +1,4 @@ +extension=apcu.so +apc.enabled=1 +apc.shm_size=128M +apc.ttl=7200 diff --git a/nextcloud/10.0/cron b/nextcloud/10.0/cron new file mode 100644 index 0000000..8d5ad0a --- /dev/null +++ b/nextcloud/10.0/cron @@ -0,0 +1,2 @@ +#!/bin/sh +su - nextcloud -c "php7 -f /nextcloud/cron.php" > /dev/null 2>&1 diff --git a/nextcloud/10.0/nginx.conf b/nextcloud/10.0/nginx.conf new file mode 100644 index 0000000..0415d4d --- /dev/null +++ b/nextcloud/10.0/nginx.conf @@ -0,0 +1,105 @@ +user nextcloud; +worker_processes auto; +pid /var/run/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 /var/log/nginx/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; + + 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 80; + index index.php; + root /nextcloud; + client_max_body_size 10G; + fastcgi_buffers 64 4K; + rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect; + rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect; + rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect; + error_page 403 /core/templates/403.php; + error_page 404 /core/templates/404.php; + + add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;"; + add_header X-Frame-Options SAMEORIGIN; + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + add_header X-Download-Options noopen; + add_header X-Permitted-Cross-Domain-Policies none; + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + location ~ ^/(data|config|\.ht|db_structure\.xml|README) { + deny all; + } + + location / { + rewrite ^/.well-known/host-meta /public.php?service=host-meta last; + rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last; + rewrite ^/.well-known/carddav /remote.php/carddav/ redirect; + rewrite ^/.well-known/caldav /remote.php/caldav/ redirect; + rewrite ^(/core/doc/[^\/]+/)$ $1/index.html; + try_files $uri $uri/ index.php; + } + + location ~ ^(.+?\.php)(/.*)?$ { + try_files $1 = 404; + include fastcgi_params; + fastcgi_param modHeadersAvailable true; + fastcgi_param SCRIPT_FILENAME $document_root$1; + fastcgi_param PATH_INFO $2; + fastcgi_pass unix:/var/run/php-fpm.sock; + } + + location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ { + expires 30d; + access_log off; + } + } +} diff --git a/nextcloud/10.0/opcache.ini b/nextcloud/10.0/opcache.ini new file mode 100644 index 0000000..861ea15 --- /dev/null +++ b/nextcloud/10.0/opcache.ini @@ -0,0 +1,8 @@ +zend_extension=opcache.so +opcache.enable=1 +opcache.enable_cli=1 +opcache.fast_shutdown=1 +opcache.memory_consumption=128 +opcache.interned_strings_buffer=16 +opcache.max_accelerated_files=5413 +opcache.revalidate_freq=60 diff --git a/nextcloud/10.0/php-fpm.conf b/nextcloud/10.0/php-fpm.conf new file mode 100644 index 0000000..fc4cfa7 --- /dev/null +++ b/nextcloud/10.0/php-fpm.conf @@ -0,0 +1,22 @@ +[global] +daemonize = no + +[www] +user = nextcloud +group = nextcloud +listen = /var/run/php-fpm.sock +listen.owner = nextcloud +listen.group = nextcloud +pm = dynamic +pm.max_children = 10 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +chdir = / +request_terminate_timeout = 1200 +env[PATH] = /usr/local/bin:/usr/bin:/bin +php_admin_value[post_max_size] = 10G +php_admin_value[upload_max_filesize] = 10G +php_admin_value[max_execution_time] = 10800 +php_admin_value[max_input_time] = 1200 + diff --git a/nextcloud/10.0/run.sh b/nextcloud/10.0/run.sh new file mode 100644 index 0000000..9885eb7 --- /dev/null +++ b/nextcloud/10.0/run.sh @@ -0,0 +1,23 @@ +#!/bin/sh +addgroup -g ${GID} nextcloud && adduser -h /nextcloud -s /bin/sh -D -G nextcloud -u ${UID} nextcloud + +if [ -f /nextcloud/config/config.php ] && [ ! -f /config/config.php ]; then + cp /nextcloud/config/config.php /config/config.php +elif [ -f /config/config.php ]; then + if [ -f /nextcloud/config/config.php ]; then + sed -i "s/.*version.*/`grep "version" \/nextcloud\/config\/config.php`/" /config/config.php + CONFIG=`md5sum /config/config.php | awk '{ print $1 }'` + CONFIGINS=`md5sum /nextcloud/config/config.php | awk '{ print $1 }'` + if [ $CONFIG != $CONFIGINS ]; then + mv /nextcloud/config/config.php /config/config.php.bkp + fi + fi + cp /config/config.php /nextcloud/config/config.php +fi + +touch /var/run/php-fpm.sock +mkdir /tmp/fastcgi /tmp/client_body +chown -R nextcloud:nextcloud /nextcloud /data /config /apps2 /var/run/php-fpm.sock /var/lib/nginx /tmp +ln -s /apps2 /nextcloud + +supervisord -c /etc/supervisor/supervisord.conf diff --git a/nextcloud/10.0/supervisord.conf b/nextcloud/10.0/supervisord.conf new file mode 100644 index 0000000..bbabd57 --- /dev/null +++ b/nextcloud/10.0/supervisord.conf @@ -0,0 +1,11 @@ +[supervisord] +nodaemon=true + +[program:cron] +command=crond -f + +[program:php-fpm] +command=php-fpm7 + +[program:nginx] +command=nginx diff --git a/nextcloud/9.0/Dockerfile b/nextcloud/9.0/Dockerfile index 8f29d9c..9ef5dfe 100644 --- a/nextcloud/9.0/Dockerfile +++ b/nextcloud/9.0/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:edge +FROM alpine:3.4 MAINTAINER Wonderfall ARG NEXTCLOUD_VERSION=9.0.53 @@ -32,6 +32,7 @@ RUN echo "@commuedge https://nl.alpinelinux.org/alpine/edge/community" >> /etc/a php7-iconv@testing \ php7-pdo_mysql@testing \ php7-pdo_pgsql@testing \ + php7-pgsql@testing \ php7-zlib@testing \ php7-zip@testing \ php7-xmlreader@testing \ diff --git a/nextcloud/README.md b/nextcloud/README.md index ffa5949..acd87db 100644 --- a/nextcloud/README.md +++ b/nextcloud/README.md @@ -12,16 +12,11 @@ - LDAP support. - UID/GID flexibility. -| Docker Hub Image | Base Image | Image Size | -| ------------------- | -------------- | ---------- | -| **wonderfall/nextcloud** | **alpine:edge** | **201.9 MB** | -| greyltc/nextcloud | archlinux | 2.439 GB | -| thallian/nextcloud | alpine | 227 MB | -| mrxra/nextcloud | debian:jessie | 1.045 GB | - #### Tags - **latest** : latest stable version. -- **9.0** : latest 9.0.x version. +- **9.0** : latest 9.0.x version. (stable) +- **10.0** : latest 10.0.x version (beta!) +- **test** : latest test version provided by Nextcloud (RC, Beta...) - **daily** : latest code (daily build). #### Build-time variables diff --git a/nextcloud/daily/Dockerfile b/nextcloud/daily/Dockerfile index bbb0741..84c0168 100644 --- a/nextcloud/daily/Dockerfile +++ b/nextcloud/daily/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:edge +FROM alpine:3.4 MAINTAINER Wonderfall ENV GID=991 UID=991 @@ -29,6 +29,7 @@ RUN echo "@commuedge https://nl.alpinelinux.org/alpine/edge/community" >> /etc/a php7-iconv@testing \ php7-pdo_mysql@testing \ php7-pdo_pgsql@testing \ + php7-pgsql@testing \ php7-zlib@testing \ php7-zip@testing \ php7-xmlreader@testing \