forked from x86dev/docker-ttrss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now based on Alpine Linux and s6 as supervisor, resulting in a much s…
…maller Docker image. See README.md for details and other additions.
- Loading branch information
Showing
23 changed files
with
199 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,33 @@ | ||
FROM kdelfour/supervisor-docker | ||
# Using https://github.com/smebberson/docker-alpine, which in turn | ||
# uses https://github.com/just-containers/s6-overlay for a s6 Docker overlay | ||
FROM smebberson/alpine-base | ||
# Initially was based on work of Christian Lück <christian@lueck.tv> | ||
MAINTAINER Andreas Löffler <andy@x86dev.com> | ||
LABEL description="A complete, self-hosted Tiny Tiny RSS (TTRSS) environment." \ | ||
maintainer="Andreas Löffler <andy@x86dev.com>" | ||
|
||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \ | ||
nginx git ca-certificates php5-fpm php5-cli php5-curl php5-gd php5-json php5-mcrypt php5-pgsql | ||
RUN set -xe && \ | ||
apk update && apk upgrade && \ | ||
apk add --no-cache --virtual=run-deps \ | ||
nginx git ca-certificates \ | ||
php5 php5-fpm php5-curl php5-dom php5-gd php5-json php5-mcrypt php5-pcntl php5-pdo php5-pdo_pgsql php5-pgsql php5-posix | ||
|
||
# add ttrss as the only Nginx site | ||
ADD ttrss-nginx.conf /etc/nginx/sites-available/ttrss | ||
RUN ln -s /etc/nginx/sites-available/ttrss /etc/nginx/sites-enabled/ttrss | ||
RUN rm /etc/nginx/sites-enabled/default | ||
# Add user www-data for php-fpm | ||
# 82 is the standard uid/gid for "www-data" in Alpine | ||
RUN adduser -u 82 -D -S -G www-data www-data | ||
|
||
# patch php5-fpm configuration so that it does not daemonize itself. This is | ||
# needed so that runit can watch its state and restart it if it crashes etc. | ||
RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf | ||
|
||
# patch the php-fpm's listening method to _always_ use a unix socket | ||
# note: if not done correctly this will result in a "502 Bad Gateway" error | ||
# (see /var/log/nginx/error.log for more information then) | ||
RUN sed -i -e "s/listen\s*=.*/listen = \/var\/run\/php5-fpm.sock/g" /etc/php5/fpm/pool.d/www.conf | ||
|
||
# enable PHP5 modules | ||
RUN php5enmod mcrypt | ||
COPY root / | ||
|
||
# expose Nginx ports | ||
EXPOSE 80 | ||
EXPOSE 443 | ||
EXPOSE 8080 | ||
EXPOSE 4443 | ||
|
||
# expose default database credentials via ENV in order to ease overwriting | ||
ENV DB_NAME ttrss | ||
ENV DB_USER ttrss | ||
ENV DB_PASS ttrss | ||
|
||
# always re-configure database with current ENV when RUNning container, then monitor all services | ||
RUN mkdir -p /srv | ||
ADD ttrss-utils.php /srv/ttrss-utils.php | ||
ADD ttrss-configure-db.php /srv/ttrss-configure-db.php | ||
ADD ttrss-configure-plugin-mobilize.php /srv/ttrss-configure-plugin-mobilize.php | ||
ADD ttrss-plugin-mobilize.pgsql /srv/ttrss-plugin-mobilize.pgsql | ||
|
||
ADD setup-ttrss.sh /srv/setup-ttrss.sh | ||
ADD update-ttrss.sh /srv/update-ttrss.sh | ||
ADD start-ttrss.sh /srv/start-ttrss.sh | ||
|
||
RUN mkdir -p /etc/supervisor/conf.d | ||
ADD service-nginx.conf /etc/supervisor/conf.d/nginx.conf | ||
ADD service-php5-fpm.conf /etc/supervisor/conf.d/php5.conf | ||
ADD service-ttrss-daemon.conf /etc/supervisor/conf.d/ttrss-daemon.conf | ||
ADD service-ttrss-update.conf /etc/supervisor/conf.d/ttrss-update.conf | ||
|
||
# only run the setup once | ||
RUN /srv/setup-ttrss.sh | ||
RUN set -xe && /srv/setup-ttrss.sh | ||
|
||
# clean up | ||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# start supervisord | ||
WORKDIR /srv | ||
CMD ["/srv/start-ttrss.sh"] | ||
RUN set -xe && apk del --progress --purge && rm -rf /var/cache/apk/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/with-contenv sh | ||
cd /srv && ./setup-ttrss.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
user www-data; | ||
worker_processes auto; | ||
pid /tmp/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; | ||
error_log /var/log/nginx/error.log debug; | ||
|
||
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; | ||
proxy_temp_path /tmp/proxy 1 2; | ||
uwsgi_temp_path /tmp/uwsgi 1 2; | ||
scgi_temp_path /tmp/scgi 1 2; | ||
|
||
gzip off; | ||
|
||
server | ||
{ | ||
listen 4443; | ||
root /var/www/ttrss; | ||
|
||
ssl on; | ||
ssl_certificate /etc/ssl/certs/ttrss.crt; | ||
ssl_certificate_key /etc/ssl/private/ttrss.key; | ||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | ||
ssl_prefer_server_ciphers on; | ||
ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA"; | ||
|
||
index index.php index.html; | ||
client_max_body_size 100M; | ||
|
||
location / { | ||
try_files $uri $uri/ =404; | ||
} | ||
|
||
location ~ \.php$ { | ||
fastcgi_split_path_info ^(.*\.php)(/.*)?$; | ||
fastcgi_pass unix:/tmp/php-fpm.sock; | ||
fastcgi_index index.php; | ||
include fastcgi_params; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_intercept_errors off; | ||
fastcgi_buffer_size 16k; | ||
fastcgi_buffers 4 16k; | ||
} | ||
|
||
location ~ /\.ht { | ||
deny all; | ||
} | ||
|
||
location ~ \.php$ { | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
fastcgi_pass unix:/tmp/php-fpm.sock; | ||
fastcgi_index index.php; | ||
include fastcgi_params; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[global] | ||
daemonize = no | ||
|
||
[www] | ||
user = www-data | ||
listen.owner = www-data | ||
listen.group = www-data | ||
listen = /tmp/php-fpm.sock | ||
pm = dynamic | ||
pm.max_children = 15 | ||
pm.start_servers = 2 | ||
pm.min_spare_servers = 1 | ||
pm.max_spare_servers = 6 | ||
chdir = /var/www/ttrss/ | ||
request_terminate_timeout = 0 | ||
env[PATH] = /usr/local/bin:/usr/bin:/bin | ||
php_admin_value[max_execution_time] = 10800 | ||
php_admin_value[max_input_time] = 3600 | ||
php_admin_value[expose_php] = Off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
exec nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
exec php-fpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
while true; do | ||
cd /var/www/ttrss | ||
php -f /var/www/ttrss/update_daemon2.php | ||
sleep 5m | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
while true; do | ||
/srv/update-ttrss.sh | ||
sleep 24h | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# Update configuration. This is necessary for entering the current IP + PORT of the database. | ||
/srv/update-ttrss.sh --no-start | ||
|
||
# Call the image's init script which in turn calls the s6 supervisor then. | ||
/init |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.