diff --git a/selfoss/Dockerfile b/selfoss/Dockerfile new file mode 100644 index 0000000..891fcd3 --- /dev/null +++ b/selfoss/Dockerfile @@ -0,0 +1,41 @@ +FROM alpine:3.3 +MAINTAINER Wonderfall + +ENV GID=991 UID=991 VERSION=2.15 + +RUN echo "@commuedge http://nl.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ + && apk -U add \ + musl \ + nginx \ + php-fpm \ + php-gd \ + php-json \ + php-zlib \ + php-xml \ + php-dom \ + php-curl \ + php-iconv \ + php-mcrypt \ + php-pdo_sqlite \ + php-ctype \ + supervisor \ + ca-certificates \ + tini@commuedge \ + && rm -f /var/cache/apk/* \ + && sed -i -e 's/max_execution_time = 30/max_execution_time = 300/' /etc/php/php.ini + +RUN wget -q https://github.com/SSilence/selfoss/releases/download/$VERSION/selfoss-$VERSION.zip -P /tmp \ + && mkdir /selfoss && unzip -q /tmp/selfoss-$VERSION.zip -d /selfoss \ + && rm -rf /tmp/* + +COPY nginx.conf /etc/nginx/nginx.conf +COPY php-fpm.conf /etc/php/php-fpm.conf +COPY supervisord.conf /etc/supervisor/supervisord.conf +COPY startup /usr/local/bin/startup +COPY cron /etc/periodic/15min/selfoss + +RUN chmod +x /usr/local/bin/startup /etc/periodic/15min/selfoss + +VOLUME /selfoss/data +EXPOSE 80 +CMD ["tini","--","startup"] diff --git a/selfoss/README.md b/selfoss/README.md new file mode 100644 index 0000000..9f58be2 --- /dev/null +++ b/selfoss/README.md @@ -0,0 +1,45 @@ +# hardware/selfoss + +![selfoss](https://i.imgur.com/8hJyBgk.png "selfoss") + +The new multipurpose rss reader, live stream, mashup, aggregation web application. + +### Requirement + +- Docker 1.0 or higher + +### How to use + +``` +docker run -d \ + --name selfoss \ + -p 80:80 \ + -v /mnt/docker/selfoss:/selfoss/data \ + hardware/selfoss +``` + +### Environment variables + +- **VERSION** = selfoss version (*optional*, default: 2.15) +- **GID** = selfoss user id (*optional*, default: 991) +- **UID** = selfoss group id (*optional*, default: 991) + +### Docker-compose + +#### Docker-compose.yml + +``` +selfoss: + image: hardware/selfoss + container_name: selfoss + ports: + - "80:80" + volumes: + - /mnt/docker/selfoss:/selfoss/data +``` + +#### Run ! + +``` +docker-compose up -d +``` diff --git a/selfoss/cron b/selfoss/cron new file mode 100644 index 0000000..c04c1e3 --- /dev/null +++ b/selfoss/cron @@ -0,0 +1,3 @@ +#!/bin/sh + +su - selfoss -c "/usr/bin/php --file /selfoss/cliupdate.php" > /dev/null 2>&1 \ No newline at end of file diff --git a/selfoss/nginx.conf b/selfoss/nginx.conf new file mode 100644 index 0000000..5aa2fc0 --- /dev/null +++ b/selfoss/nginx.conf @@ -0,0 +1,81 @@ +user selfoss; +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 /var/log/nginx/access.log combined; + error_log /var/log/nginx/error.log error; + + sendfile on; + keepalive_timeout 15; + keepalive_disable msie6; + keepalive_requests 100; + tcp_nopush on; + tcp_nodelay off; + server_tokens off; + + 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; + root /selfoss; + index index.php; + charset utf-8; + + location ~ ^/favicons/.*$ { + try_files $uri /data/$uri; + } + + location ~ ^/thumbnails/.*$ { + try_files $uri /data/$uri; + } + + location ~* ^/(data\/logs|data\/sqlite|config\.ini|\.ht) { + deny all; + } + + location / { + try_files $uri /public/$uri /index.php$is_args$args; + } + + location ~* \.php$ { + try_files $uri =404; + fastcgi_index index.php; + fastcgi_pass unix:/var/run/php-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include /etc/nginx/fastcgi_params; + } + } + +} \ No newline at end of file diff --git a/selfoss/php-fpm.conf b/selfoss/php-fpm.conf new file mode 100644 index 0000000..73cac31 --- /dev/null +++ b/selfoss/php-fpm.conf @@ -0,0 +1,16 @@ +[global] +daemonize = no + +[www] +user = selfoss +group = selfoss +listen = /var/run/php-fpm.sock +listen.owner = selfoss +listen.group = selfoss +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +chdir = / +request_terminate_timeout = 300 \ No newline at end of file diff --git a/selfoss/startup b/selfoss/startup new file mode 100644 index 0000000..033e2e2 --- /dev/null +++ b/selfoss/startup @@ -0,0 +1,24 @@ +#!/bin/sh + +# Create user and set permission +addgroup -g ${GID} selfoss && adduser -h /selfoss -s /bin/sh -D -G selfoss -u ${UID} selfoss + +# Selfoss custom configuration file +rm /selfoss/config.ini + +if [ -e /selfoss/data/config.ini ]; then + cp /selfoss/data/config.ini /selfoss/config.ini +else + cp /selfoss/defaults.ini /selfoss/config.ini +fi + +# Init data dir +if [ ! "$(ls -A /selfoss/data)" ]; then + cd /selfoss/data/ && mkdir cache favicons logs sqlite thumbnails +fi + +# Set permissions +chown -R selfoss:selfoss /selfoss /var/run/php-fpm.sock /var/lib/nginx /tmp + +# RUN ! +supervisord -c /etc/supervisor/supervisord.conf diff --git a/selfoss/supervisord.conf b/selfoss/supervisord.conf new file mode 100644 index 0000000..d5df8ee --- /dev/null +++ b/selfoss/supervisord.conf @@ -0,0 +1,11 @@ +[supervisord] +nodaemon=true + +[program:cron] +command=crond -f + +[program:php-fpm] +command=php-fpm + +[program:nginx] +command=nginx \ No newline at end of file