Browse Source

Use Alpine/Nginx/PHP7 for the Docker image

master
Frédéric Guillot 5 years ago
parent
commit
b06d6e153f
  1. 2
      .gitattributes
  2. 44
      Dockerfile
  3. 36
      README.markdown
  4. 2
      docker-compose.yml
  5. 69
      docker/etc/nginx/nginx.conf
  6. 15
      docker/etc/php7/conf.d/local.ini
  7. 19
      docker/etc/php7/php-fpm.conf
  8. 2
      docker/etc/php7/php-fpm.d/env.conf
  9. 2
      docker/etc/services.d/.s6-svscan/finish
  10. 2
      docker/etc/services.d/cron/run
  11. 3
      docker/etc/services.d/nginx/run
  12. 2
      docker/etc/services.d/php/run
  13. 6
      docker/usr/local/bin/entrypoint.sh
  14. 1
      docker/var/spool/crontabs/nginx
  15. 14
      docs/docker.markdown
  16. 15
      hooks/build

2
.gitattributes vendored

@ -15,6 +15,8 @@ data/*.sqlite export-ignore
scripts export-ignore
Dockerfile export-ignore
.travis.yml export-ignore
hooks export-ignore
docker export-ignore
# documentation
**/docs/ export-ignore

44
Dockerfile

@ -1,28 +1,30 @@
FROM ubuntu:16.04
FROM alpine:3.7
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
apache2 libapache2-mod-php7.0 php7.0-pgsql php7.0-mysql php7.0-sqlite3 php7.0-xml php7.0-mcrypt \
php7.0-opcache php7.0-mcrypt php7.0-mbstring php7.0-json php7.0-curl && \
apt-get clean
VOLUME /var/www/app/data
RUN echo \
"ServerName localhost\n" \
"<Directory /var/www/html/data/>\n" \
" Deny from all\n" \
"</Directory>\n" \
"<Directory /var/www/html/data/favicons/>\n" \
" Allow from all\n" \
"</Directory>\n" >> /etc/apache2/apache2.conf
EXPOSE 80
COPY . /var/www/html
ARG VERSION
RUN rm -rf /var/www/html/index.html /var/www/html/data/* && \
mkdir /var/www/html/data/favicons && \
chown -R www-data:www-data /var/www/html/data
RUN apk update && \
apk add unzip nginx bash ca-certificates s6 curl php7 php7-phar php7-curl \
php7-fpm php7-json php7-zlib php7-xml php7-dom php7-ctype php7-opcache php7-zip php7-iconv \
php7-pdo php7-pdo_mysql php7-pdo_sqlite php7-pdo_pgsql php7-mbstring php7-session \
php7-gd php7-mcrypt php7-openssl php7-sockets php7-posix php7-ldap php7-simplexml && \
rm -rf /var/cache/apk/* && \
rm -rf /var/www/localhost && \
rm -f /etc/php7/php-fpm.d/www.conf
VOLUME /var/www/html/data
RUN cd /tmp \
&& curl -sL -o miniflux.zip https://github.com/miniflux/miniflux/archive/$VERSION.zip \
&& unzip -qq miniflux.zip \
&& cd miniflux-* \
&& cp -R . /var/www/app \
&& cd /tmp \
&& rm -rf /tmp/miniflux-* /tmp/*.zip
EXPOSE 80
ADD docker/ /
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD []
CMD /usr/sbin/apache2ctl -D FOREGROUND

36
README.markdown

@ -3,8 +3,6 @@ Miniflux - Minimalist News Reader
[![Build Status](https://travis-ci.org/miniflux/miniflux.svg?branch=master)](https://travis-ci.org/miniflux/miniflux)
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/miniflux/miniflux/tree/master)
Miniflux is a minimalist and web-based RSS reader.
Features
@ -36,17 +34,17 @@ Documentation
-------------
- [ChangeLog](https://github.com/miniflux/miniflux/blob/master/ChangeLog)
- [Installation and Requirements](docs/installation.markdown)
- [Upgrade to a new version](docs/upgrade.markdown)
- [Cronjob](docs/cronjob.markdown)
- [Advanced configuration](docs/config.markdown)
- [Full article download](docs/full-article-download.markdown)
- [Translations](docs/translations.markdown)
- [Themes](docs/themes.markdown)
- [Json-RPC API](docs/json-rpc-api.markdown)
- [Fever API](docs/fever.markdown)
- [Run Miniflux with Docker](docs/docker.markdown)
- [FAQ](docs/faq.markdown)
- [Installation and Requirements](https://github.com/miniflux/miniflux/blob/master/docs/installation.markdown)
- [Upgrade to a new version](https://github.com/miniflux/miniflux/blob/master/docs/upgrade.markdown)
- [Cronjob](https://github.com/miniflux/miniflux/blob/master/docs/cronjob.markdown)
- [Advanced configuration](https://github.com/miniflux/miniflux/blob/master/docs/config.markdown)
- [Full article download](https://github.com/miniflux/miniflux/blob/master/docs/full-article-download.markdown)
- [Translations](https://github.com/miniflux/miniflux/blob/master/docs/translations.markdown)
- [Themes](https://github.com/miniflux/miniflux/blob/master/docs/themes.markdown)
- [Json-RPC API](https://github.com/miniflux/miniflux/blob/master/docs/json-rpc-api.markdown)
- [Fever API](https://github.com/miniflux/miniflux/blob/master/docs/fever.markdown)
- [Run Miniflux with Docker](https://github.com/miniflux/miniflux/blob/master/docs/docker.markdown)
- [FAQ](https://github.com/miniflux/miniflux/blob/master/docs/faq.markdown)
License
-------
@ -56,14 +54,6 @@ License
Authors
-------
- Original author: [Frédéric Guillot](https://github.com/fguillot)
- [List of contributors](CONTRIBUTORS.md)
Related projects
----------------
External projects build around Miniflux:
- Original author: Frédéric Guillot
- [List of contributors](https://github.com/miniflux/miniflux/graphs/contributors)
- [Miniflux embedded](https://github.com/repat/miniflux-embedded-android) is an Android app for Miniflux. It's basically an embedded WebView that saves your Miniflux URL and cookies. [Download on the Play Store](https://play.google.com/store/apps/details?id=de.repat.embeddedminiflux).
- [munin-miniflux](https://github.com/dewey/munin-plugins/tree/master/munin-miniflux) is a munin wildcard plugin to draw graphs of your miniflux read and unread count.
- [List of themes](docs/themes.markdown)

2
docker-compose.yml

@ -5,7 +5,7 @@ services:
ports:
- "80:80"
volumes:
- miniflux_data:/var/www/html/data
- miniflux_data:/var/www/app/data
volumes:
miniflux_data:
driver: local

69
docker/etc/nginx/nginx.conf

@ -0,0 +1,69 @@
user nginx;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server_tokens off;
access_log off;
error_log /dev/stderr;
server {
listen 80;
server_name localhost;
index index.php;
root /var/www/app;
client_max_body_size 32M;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
location ~* ^.+\.(log|sqlite)$ {
return 404;
}
location ~ /\.ht {
return 404;
}
location ~* ^.+\.(ico|jpg|gif|png|css|js|svg|eot|ttf|woff|woff2|otf)$ {
log_not_found off;
expires 7d;
etag on;
}
gzip on;
gzip_comp_level 3;
gzip_disable "msie6";
gzip_vary on;
gzip_types
text/javascript
application/javascript
application/json
text/xml
application/xml
application/rss+xml
text/css
text/plain;
}
}

15
docker/etc/php7/conf.d/local.ini

@ -0,0 +1,15 @@
expose_php = Off
error_reporting = E_ALL
display_errors = Off
log_errors = On
error_log = /dev/stderr
date.timezone = UTC
allow_url_fopen = On
post_max_size = 32M
upload_max_filesize = 32M
opcache.max_accelerated_files = 7963
opcache.validate_timestamps = Off
opcache.save_comments = 0
opcache.load_comments = 0
opcache.fast_shutdown = 1
opcache.enable_file_override = On

19
docker/etc/php7/php-fpm.conf

@ -0,0 +1,19 @@
[global]
error_log = /proc/self/fd/2
log_level = error
daemonize = no
[www]
catch_workers_output = yes
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx
listen = /var/run/php-fpm.sock
pm = dynamic
pm.max_children = 20
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 16
pm.max_requests = 2048
include = /etc/php7/php-fpm.d/env.conf

2
docker/etc/php7/php-fpm.d/env.conf

@ -0,0 +1,2 @@
env[DATABASE_URL] = $DATABASE_URL
env[DEBUG] = $DEBUG

2
docker/etc/services.d/.s6-svscan/finish

@ -0,0 +1,2 @@
#!/bin/sh
/bin/true

2
docker/etc/services.d/cron/run

@ -0,0 +1,2 @@
#!/bin/execlineb -P
crond -f

3
docker/etc/services.d/nginx/run

@ -0,0 +1,3 @@
#!/bin/execlineb -P
nginx -g "daemon off;"

2
docker/etc/services.d/php/run

@ -0,0 +1,2 @@
#!/bin/execlineb -P
php-fpm7 -F

6
docker/usr/local/bin/entrypoint.sh

@ -0,0 +1,6 @@
#!/bin/bash
mkdir -p /var/www/app/data/favicons
chown -R nginx:nginx /var/www/app/data
exec /bin/s6-svscan /etc/services.d

1
docker/var/spool/crontabs/nginx

@ -0,0 +1 @@
0 * * * * cd /var/www/app && php cronjob.php

14
docs/docker.markdown

@ -7,7 +7,7 @@ There is a `Dockerfile` in the repository to build your own container.
Use the automated build
-----------------------
Every new commit on the repository trigger a new build on [Docker Hub](https://registry.hub.docker.com/u/miniflux/miniflux/).
Every new commit on the repository trigger a new build on [Docker Hub](https://hub.docker.com/r/miniflux/miniflux/).
```bash
docker run -d --name miniflux -p 80:80 -t miniflux/miniflux:latest
@ -27,15 +27,3 @@ docker-compose up -d
- By default, the service listen on port 80
- A named volume is created to store your data on the host machine
Build your own image
--------------------
```bash
docker build -t <yourname/imagename> .
```
Run container from the image:
```bash
docker run -p 80:80 --name miniflux <yourname/imagename>
```

15
hooks/build

@ -0,0 +1,15 @@
#!/bin/bash
VERSION=master
if [ "$SOURCE_BRANCH" != "" ]; then
VERSION=$SOURCE_BRANCH
if [ "$SOURCE_BRANCH" == "latest" ]; then
VERSION=master
fi
fi
echo "Building $VERSION"
docker build --build-arg VERSION=$VERSION -t $IMAGE_NAME .
Loading…
Cancel
Save