diff options
-rw-r--r-- | .docker/.htaccess | 13 | ||||
-rw-r--r-- | .docker/nginx.conf | 72 | ||||
-rw-r--r-- | .docker/supervised.conf | 13 | ||||
-rw-r--r-- | .dockerignore | 30 | ||||
-rw-r--r-- | .gitattributes | 4 | ||||
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | Dockerfile | 42 |
7 files changed, 177 insertions, 2 deletions
diff --git a/.docker/.htaccess b/.docker/.htaccess new file mode 100644 index 00000000..f601c1ee --- /dev/null +++ b/.docker/.htaccess | |||
@@ -0,0 +1,13 @@ | |||
1 | <IfModule version_module> | ||
2 | <IfVersion >= 2.4> | ||
3 | Require all denied | ||
4 | </IfVersion> | ||
5 | <IfVersion < 2.4> | ||
6 | Allow from none | ||
7 | Deny from all | ||
8 | </IfVersion> | ||
9 | </IfModule> | ||
10 | |||
11 | <IfModule !version_module> | ||
12 | Require all denied | ||
13 | </IfModule> | ||
diff --git a/.docker/nginx.conf b/.docker/nginx.conf new file mode 100644 index 00000000..e8754d9b --- /dev/null +++ b/.docker/nginx.conf | |||
@@ -0,0 +1,72 @@ | |||
1 | user www-data www-data; | ||
2 | daemon off; | ||
3 | worker_processes 4; | ||
4 | |||
5 | events { | ||
6 | worker_connections 768; | ||
7 | } | ||
8 | |||
9 | http { | ||
10 | include mime.types; | ||
11 | default_type application/octet-stream; | ||
12 | keepalive_timeout 20; | ||
13 | |||
14 | client_max_body_size 10m; | ||
15 | |||
16 | index index.html index.php; | ||
17 | |||
18 | server { | ||
19 | listen 80; | ||
20 | root /var/www/shaarli; | ||
21 | |||
22 | access_log /var/log/nginx/shaarli.access.log; | ||
23 | error_log /var/log/nginx/shaarli.error.log; | ||
24 | |||
25 | location ~ /\. { | ||
26 | # deny access to dotfiles | ||
27 | access_log off; | ||
28 | log_not_found off; | ||
29 | deny all; | ||
30 | } | ||
31 | |||
32 | location ~ ~$ { | ||
33 | # deny access to temp editor files, e.g. "script.php~" | ||
34 | access_log off; | ||
35 | log_not_found off; | ||
36 | deny all; | ||
37 | } | ||
38 | |||
39 | location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { | ||
40 | # cache static assets | ||
41 | expires max; | ||
42 | add_header Pragma public; | ||
43 | add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | ||
44 | } | ||
45 | |||
46 | location = /favicon.ico { | ||
47 | # serve the Shaarli favicon from its custom location | ||
48 | alias /var/www/shaarli/images/favicon.ico; | ||
49 | } | ||
50 | |||
51 | location / { | ||
52 | # Slim - rewrite URLs | ||
53 | try_files $uri /index.php$is_args$args; | ||
54 | } | ||
55 | |||
56 | location ~ (index)\.php$ { | ||
57 | # Slim - split URL path into (script_filename, path_info) | ||
58 | try_files $uri =404; | ||
59 | fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
60 | |||
61 | # filter and proxy PHP requests to PHP-FPM | ||
62 | fastcgi_pass unix:/var/run/php5-fpm.sock; | ||
63 | fastcgi_index index.php; | ||
64 | include fastcgi.conf; | ||
65 | } | ||
66 | |||
67 | location ~ \.php$ { | ||
68 | # deny access to all other PHP scripts | ||
69 | deny all; | ||
70 | } | ||
71 | } | ||
72 | } | ||
diff --git a/.docker/supervised.conf b/.docker/supervised.conf new file mode 100644 index 00000000..5acd9795 --- /dev/null +++ b/.docker/supervised.conf | |||
@@ -0,0 +1,13 @@ | |||
1 | [program:php5-fpm] | ||
2 | command=/usr/sbin/php5-fpm -F | ||
3 | priority=5 | ||
4 | autostart=true | ||
5 | autorestart=true | ||
6 | |||
7 | [program:nginx] | ||
8 | command=/usr/sbin/nginx | ||
9 | priority=10 | ||
10 | autostart=true | ||
11 | autorestart=true | ||
12 | stdout_events_enabled=true | ||
13 | stderr_events_enabled=true | ||
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..c92a2a14 --- /dev/null +++ b/.dockerignore | |||
@@ -0,0 +1,30 @@ | |||
1 | # Shaarli runtime resources | ||
2 | cache/* | ||
3 | data/* | ||
4 | pagecache/* | ||
5 | tmp/* | ||
6 | |||
7 | # Eclipse project files | ||
8 | .settings | ||
9 | .buildpath | ||
10 | .project | ||
11 | |||
12 | # Raintpl generated pages | ||
13 | *.rtpl.php | ||
14 | |||
15 | # 3rd-party dependencies | ||
16 | composer.lock | ||
17 | vendor/ | ||
18 | |||
19 | # Release archives | ||
20 | *.tar | ||
21 | *.zip | ||
22 | |||
23 | # Development and test resources | ||
24 | coverage | ||
25 | doxygen | ||
26 | sandbox | ||
27 | phpmd.html | ||
28 | |||
29 | # User plugin configuration | ||
30 | plugins/*/config.php | ||
diff --git a/.gitattributes b/.gitattributes index d753b1db..a3a22a15 100644 --- a/.gitattributes +++ b/.gitattributes | |||
@@ -23,7 +23,9 @@ Dockerfile text | |||
23 | .travis.yml export-ignore | 23 | .travis.yml export-ignore |
24 | doc/**/*.json export-ignore | 24 | doc/**/*.json export-ignore |
25 | doc/**/*.md export-ignore | 25 | doc/**/*.md export-ignore |
26 | docker/ export-ignore | 26 | .docker/ export-ignore |
27 | .dockerignore export-ignore | ||
28 | Dockerfile export-ignore | ||
27 | Doxyfile export-ignore | 29 | Doxyfile export-ignore |
28 | Makefile export-ignore | 30 | Makefile export-ignore |
29 | phpunit.xml export-ignore | 31 | phpunit.xml export-ignore |
diff --git a/CHANGELOG.md b/CHANGELOG.md index 84dc18cc..90841018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
@@ -4,9 +4,12 @@ All notable changes to this project will be documented in this file. | |||
4 | The format is based on [Keep a Changelog](http://keepachangelog.com/) | 4 | The format is based on [Keep a Changelog](http://keepachangelog.com/) |
5 | and this project adheres to [Semantic Versioning](http://semver.org/). | 5 | and this project adheres to [Semantic Versioning](http://semver.org/). |
6 | 6 | ||
7 | ## [v0.8.7](https://github.com/shaarli/Shaarli/releases/tag/v0.8.7) - UNPUBLISHED | ||
8 | ### Changed | ||
9 | - Build the Docker image from the local Git sources | ||
7 | 10 | ||
8 | ## [v0.8.6](https://github.com/shaarli/Shaarli/releases/tag/v0.8.5) - 2018-02-19 | ||
9 | 11 | ||
12 | ## [v0.8.6](https://github.com/shaarli/Shaarli/releases/tag/v0.8.6) - 2018-02-19 | ||
10 | ### Changed | 13 | ### Changed |
11 | - Run version check tests against the 'stable' branch | 14 | - Run version check tests against the 'stable' branch |
12 | 15 | ||
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..5e03814c --- /dev/null +++ b/Dockerfile | |||
@@ -0,0 +1,42 @@ | |||
1 | # Stage 1: | ||
2 | # - Get Shaarli sources | ||
3 | # - Resolve PHP dependencies with Composer | ||
4 | FROM composer:latest as composer | ||
5 | ADD . /app/shaarli | ||
6 | RUN cd shaarli \ | ||
7 | && composer --prefer-dist --no-dev install | ||
8 | |||
9 | # Stage 2: | ||
10 | # - Shaarli image | ||
11 | FROM debian:jessie | ||
12 | LABEL maintainer="Shaarli Community" | ||
13 | |||
14 | ENV TERM dumb | ||
15 | RUN apt-get update \ | ||
16 | && apt-get install --no-install-recommends -y \ | ||
17 | ca-certificates \ | ||
18 | curl \ | ||
19 | nginx-light \ | ||
20 | php5-curl \ | ||
21 | php5-fpm \ | ||
22 | php5-gd \ | ||
23 | php5-intl \ | ||
24 | supervisor \ | ||
25 | && apt-get clean | ||
26 | |||
27 | RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini \ | ||
28 | && sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini | ||
29 | |||
30 | COPY .docker/nginx.conf /etc/nginx/nginx.conf | ||
31 | COPY .docker/supervised.conf /etc/supervisor/conf.d/supervised.conf | ||
32 | |||
33 | WORKDIR /var/www | ||
34 | COPY --from=composer /app/shaarli shaarli | ||
35 | RUN rm -rf html \ | ||
36 | && chown -R www-data:www-data . | ||
37 | |||
38 | VOLUME /var/www/shaarli/data | ||
39 | |||
40 | EXPOSE 80 | ||
41 | |||
42 | CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"] | ||