From 25d7f58a75ed715a0347c2cc393076714e9e2369 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 3 Nov 2017 19:42:10 +0000 Subject: [PATCH] first commit --- Dockerfile | 22 ++++++++++++++++ rootfs/nginx/sites-enabled/shaarli.conf | 34 +++++++++++++++++++++++++ rootfs/usr/local/bin/startup | 22 ++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 Dockerfile create mode 100644 rootfs/nginx/sites-enabled/shaarli.conf create mode 100755 rootfs/usr/local/bin/startup diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..04a84a3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM xataz/nginx-php + +ARG SHAARLI_VERSION=0.9.2 +ENV URL=shaarli.localdomain.tld + +RUN apk -U add wget zip \ + && cd /tmp \ + && curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/local/bin \ + && wget https://github.com/shaarli/Shaarli/releases/download/v$SHAARLI_VERSION/shaarli-v$SHAARLI_VERSION-full.zip \ + && unzip shaarli-v$SHAARLI_VERSION-full.zip \ + && mv Shaarli/ /shaarli \ + && wget https://github.com/kalvn/Shaarli-Material/archive/v$SHAARLI_VERSION.zip \ + && unzip v$SHAARLI_VERSION.zip \ + && mv Shaarli-Material-$SHAARLI_VERSION/material/ /shaarli/tpl/ \ + && cd /shaarli \ + && composer install \ + && chmod +w cache pagecache data tmp \ + && apk del wget zip \ + && rm -rf /tmp/* /var/cache/apk/* /usr/src/* + +COPY rootfs / +VOLUME /shaarli/data /plugins diff --git a/rootfs/nginx/sites-enabled/shaarli.conf b/rootfs/nginx/sites-enabled/shaarli.conf new file mode 100644 index 0000000..7ddfebf --- /dev/null +++ b/rootfs/nginx/sites-enabled/shaarli.conf @@ -0,0 +1,34 @@ +server { + listen 8080; + server_name ; + index index.php index.html index.htm; + merge_slashes off; + large_client_header_buffers 4 32k; + root /shaarli/; + + location / { + try_files $uri $uri/ @handler; + expires 30d; + root /shaarli/; + index index.html index.htm index.php; + } + + location /[.*] { + try_files $uri $uri/ @handler; + expires 30d; + root /shaarli/; + index index.html index.htm index.php; + } + + location @handler { + rewrite ^ /index.php?/$request_uri; + } + + location ~ \.php$ { + fastcgi_index index.php; + fastcgi_pass unix:/php/run/php-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include /nginx/conf/fastcgi_params; + } +} + diff --git a/rootfs/usr/local/bin/startup b/rootfs/usr/local/bin/startup new file mode 100755 index 0000000..5f2a041 --- /dev/null +++ b/rootfs/usr/local/bin/startup @@ -0,0 +1,22 @@ +#!/bin/sh + +addgroup -g ${GID} web && adduser -H -s /bin/sh -D -G web -u ${UID} web + +sed -i -e 's//'$URL'/g' /nginx/sites-enabled/shaarli.conf + + +mkdir -p /nginx /php +if [ `find /plugins -type f | wc -l` -eq 0 ] ; then + cp -R /shaarli/plugins/* /plugins/ +else + cp -R /plugins/* /shaarli/plugins +fi + +chown -R web:web /nginx /php /shaarli/data /etc/s6.d +chmod +x /etc/s6.d/*/run /etc/s6.d/.s6-svscan/finish + +if [ '$@' == '' ]; then + exec su-exec web:web /bin/s6-svscan /etc/s6.d +else + exec su-exec web:web "$@" +fi