Browse Source

first commit

master
root 1 year ago
commit
25d7f58a75
3 changed files with 78 additions and 0 deletions
  1. 22
    0
      Dockerfile
  2. 34
    0
      rootfs/nginx/sites-enabled/shaarli.conf
  3. 22
    0
      rootfs/usr/local/bin/startup

+ 22
- 0
Dockerfile View File

@@ -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

+ 34
- 0
rootfs/nginx/sites-enabled/shaarli.conf View File

@@ -0,0 +1,34 @@
server {
listen 8080;
server_name <URL>;
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;
}
}


+ 22
- 0
rootfs/usr/local/bin/startup View File

@@ -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>/'$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

Loading…
Cancel
Save