From 305f10445530fdca77f47e9b41709396be0ef08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Christian=20Gr=C3=BCnhage?= Date: Sun, 28 Jan 2018 11:12:19 +0100 Subject: [PATCH] initial impl --- .drone.yml | 11 +++++++++++ Caddyfile | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 .drone.yml create mode 100644 Caddyfile create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..eaf8950 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,11 @@ +pipeline: + download: + image: docker.io/fedora + commands: + - curl https://download.nextcloud.com/server/releases/nextcloud-12.0.5.tar.bz2 > nextcloud.tar.bz2 + docker: + image: plugins/docker + repo: docker.jcg.re/rainloop + registry: docker.jcg.re + secrets: [ docker_username, docker_password ] + tags: latest diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..237339c --- /dev/null +++ b/Caddyfile @@ -0,0 +1,53 @@ +:8888 +root /nextcloud +log /log/access.log +errors /log/errors.log + +fastcgi / /tmp/php-fpm.sock php { + env PATH /bin +} + +# checks for images +rewrite { + ext .svg .gif .png .html .ttf .woff .ico .jpg .jpeg + r ^/index.php/(.+)$ + to /{1} /index.php?{1} +} + +rewrite { + r ^/index.php/.*$ + to /index.php?{query} +} + +# client support (e.g. os x calendar / contacts) +redir /.well-known/carddav /remote.php/carddav 301 +redir /.well-known/caldav /remote.php/caldav 301 + +# remove trailing / as it causes errors with php-fpm +rewrite { + r ^/remote.php/(webdav|caldav|carddav|dav)(\/?)$ + to /remote.php/{1} +} + +rewrite { + r ^/remote.php/(webdav|caldav|carddav|dav)/(.+?)(\/?)$ + to /remote.php/{1}/{2} +} + +rewrite { + r ^/public.php/(.+?)(\/?)$ + to /public.php/(.+?)(\/?)$ +} + +# .htaccess / data / config / ... shouldn't be accessible from outside +status 403 { + /.htacces + /data + /config + /db_structure + /.xml + /README + /log +} + +header / Strict-Transport-Security "max-age=31536000;" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0329bed --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +FROM docker.jcg.re/base-php +ADD nextcloud.tar.bz2 /nextcloud +RUN apk add --no-cache \ + php7-ctype \ + php7-dom \ + php7-gd \ + php7-iconv \ + php7-json \ + php7-xml \ + php7-mbstring \ + php7-posix \ + php7-simplexml \ + php7-xmlreader \ + php7-xmlwriter \ + php7-zip \ + php7-zlib \ + php7-pdo_sqlite \ + php7-pdo_mysql \ + php7-pdo_pgsql \ + php7-curl \ + php7-fileinfo \ + php7-bz2 \ + php7-intl \ + php7-mcrypt \ + php7-openssl \ + php7-ldap \ + php7-ftp \ + php7-imap \ + php7-exif \ + php7-gmp \ + php7-apcu \ + php7-memcached \ + php7-redis \ + php7-imagick \ + php7-pcntl \ + ffmpeg \ + && mv nextcloud/nextcloud/* nextcloud \ + && mkdir log \ + && chmod -R a+rw log \ + && sed -i "s#/phpapp#/nextcloud#" /etc/Caddyfile \ + && sed -i "s#/phpapp#/nextcloud#" /etc/s6.d/php/run +COPY Caddyfile /etc/Caddyfile