aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVirtualTam <virtualtam+github@flibidi.net>2018-06-20 16:29:06 +0200
committerGitHub <noreply@github.com>2018-06-20 16:29:06 +0200
commit9e425954817621711a528bb3bd2972692a2a528a (patch)
treee692e493688fea3f8d681c093ed574d90d75daa3
parentc648fc34f882ca6a62f5a44d1826bbd2b9852845 (diff)
parent55346c1ebed66ce29dee0eee1fec5602b2d26078 (diff)
downloadShaarli-9e425954817621711a528bb3bd2972692a2a528a.tar.gz
Shaarli-9e425954817621711a528bb3bd2972692a2a528a.tar.zst
Shaarli-9e425954817621711a528bb3bd2972692a2a528a.zip
Merge pull request #1156 from virtualtam/v0.8-dockerfile
v0.8 - Build the Docker image from the local sources
-rw-r--r--.docker/.htaccess (renamed from docker/.htaccess)0
-rw-r--r--.docker/nginx.conf (renamed from docker/development/nginx.conf)17
-rw-r--r--.docker/supervised.conf (renamed from docker/development/supervised.conf)0
-rw-r--r--.dockerignore34
-rw-r--r--.gitattributes4
-rw-r--r--.travis.yml2
-rw-r--r--CHANGELOG.md8
-rw-r--r--Dockerfile50
-rw-r--r--Makefile11
-rw-r--r--docker/development/Dockerfile38
-rw-r--r--docker/development/IMAGE.md10
-rw-r--r--docker/production/Dockerfile37
-rw-r--r--docker/production/IMAGE.md5
-rw-r--r--docker/production/nginx.conf63
-rw-r--r--docker/production/stable/Dockerfile37
-rw-r--r--docker/production/stable/IMAGE.md5
-rw-r--r--docker/production/stable/nginx.conf63
-rw-r--r--docker/production/stable/supervised.conf13
-rw-r--r--docker/production/supervised.conf13
19 files changed, 112 insertions, 298 deletions
diff --git a/docker/.htaccess b/.docker/.htaccess
index f601c1ee..f601c1ee 100644
--- a/docker/.htaccess
+++ b/.docker/.htaccess
diff --git a/docker/development/nginx.conf b/.docker/nginx.conf
index ac0c6c61..e8754d9b 100644
--- a/docker/development/nginx.conf
+++ b/.docker/nginx.conf
@@ -22,14 +22,6 @@ http {
22 access_log /var/log/nginx/shaarli.access.log; 22 access_log /var/log/nginx/shaarli.access.log;
23 error_log /var/log/nginx/shaarli.error.log; 23 error_log /var/log/nginx/shaarli.error.log;
24 24
25 location /phpinfo/ {
26 # add a PHP info page for convenience
27 fastcgi_pass unix:/var/run/php5-fpm.sock;
28 fastcgi_index index.php;
29 fastcgi_param SCRIPT_FILENAME /var/www/index.php;
30 include fastcgi_params;
31 }
32
33 location ~ /\. { 25 location ~ /\. {
34 # deny access to dotfiles 26 # deny access to dotfiles
35 access_log off; 27 access_log off;
@@ -56,7 +48,16 @@ http {
56 alias /var/www/shaarli/images/favicon.ico; 48 alias /var/www/shaarli/images/favicon.ico;
57 } 49 }
58 50
51 location / {
52 # Slim - rewrite URLs
53 try_files $uri /index.php$is_args$args;
54 }
55
59 location ~ (index)\.php$ { 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
60 # filter and proxy PHP requests to PHP-FPM 61 # filter and proxy PHP requests to PHP-FPM
61 fastcgi_pass unix:/var/run/php5-fpm.sock; 62 fastcgi_pass unix:/var/run/php5-fpm.sock;
62 fastcgi_index index.php; 63 fastcgi_index index.php;
diff --git a/docker/development/supervised.conf b/.docker/supervised.conf
index 5acd9795..5acd9795 100644
--- a/docker/development/supervised.conf
+++ b/.docker/supervised.conf
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..9a18e085
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,34 @@
1# Docker-ignore
2# Note: .git/ is kept for HTML documentation generation
3tests
4
5# Shaarli runtime resources
6cache/*
7data/*
8pagecache/*
9tmp/*
10
11# Eclipse project files
12.settings
13.buildpath
14.project
15
16# Raintpl generated pages
17*.rtpl.php
18
19# 3rd-party dependencies
20composer.lock
21vendor/
22
23# Release archives
24*.tar
25*.zip
26
27# Development and test resources
28coverage
29doxygen
30sandbox
31phpmd.html
32
33# User plugin configuration
34plugins/*/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
24doc/**/*.json export-ignore 24doc/**/*.json export-ignore
25doc/**/*.md export-ignore 25doc/**/*.md export-ignore
26docker/ export-ignore 26.docker/ export-ignore
27.dockerignore export-ignore
28Dockerfile export-ignore
27Doxyfile export-ignore 29Doxyfile export-ignore
28Makefile export-ignore 30Makefile export-ignore
29phpunit.xml export-ignore 31phpunit.xml export-ignore
diff --git a/.travis.yml b/.travis.yml
index 6ff1b20f..e59c8f6a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ php:
9 - 5.6 9 - 5.6
10 - 5.5 10 - 5.5
11 - 5.4 11 - 5.4
12 - 5.3 12 # - 5.3 # Not supported by Travis CI
13install: 13install:
14 - composer self-update 14 - composer self-update
15 - composer install --prefer-dist 15 - composer install --prefer-dist
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 84dc18cc..3f5bafd1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,9 +4,15 @@ All notable changes to this project will be documented in this file.
4The format is based on [Keep a Changelog](http://keepachangelog.com/) 4The format is based on [Keep a Changelog](http://keepachangelog.com/)
5and this project adheres to [Semantic Versioning](http://semver.org/). 5and 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
10
11### Removed
12- Disable PHP 5.3 Travis build (unsupported)
7 13
8## [v0.8.6](https://github.com/shaarli/Shaarli/releases/tag/v0.8.5) - 2018-02-19
9 14
15## [v0.8.6](https://github.com/shaarli/Shaarli/releases/tag/v0.8.6) - 2018-02-19
10### Changed 16### Changed
11- Run version check tests against the 'stable' branch 17- Run version check tests against the 'stable' branch
12 18
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..e8067031
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,50 @@
1# Stage 1:
2# - Get Shaarli sources
3# - Build documentation
4FROM dalibo/pandocker:stable as docs
5ADD . /pandoc/shaarli
6RUN cd /pandoc/shaarli \
7 && make htmldoc \
8 && rm -rf .git
9
10# Stage 2:
11# - Resolve PHP dependencies with Composer
12FROM composer:latest as composer
13COPY --from=docs /pandoc/shaarli /app/shaarli
14RUN cd shaarli \
15 && composer --prefer-dist --no-dev install
16
17# Stage 3:
18# - Shaarli image
19FROM debian:jessie
20LABEL maintainer="Shaarli Community"
21
22ENV TERM dumb
23RUN apt-get update \
24 && apt-get install --no-install-recommends -y \
25 ca-certificates \
26 curl \
27 nginx-light \
28 php5-curl \
29 php5-fpm \
30 php5-gd \
31 php5-intl \
32 supervisor \
33 && apt-get clean
34
35RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini \
36 && sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini
37
38COPY .docker/nginx.conf /etc/nginx/nginx.conf
39COPY .docker/supervised.conf /etc/supervisor/conf.d/supervised.conf
40
41WORKDIR /var/www
42COPY --from=composer /app/shaarli shaarli
43RUN rm -rf html \
44 && chown -R www-data:www-data .
45
46VOLUME /var/www/shaarli/data
47
48EXPOSE 80
49
50CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
diff --git a/Makefile b/Makefile
index 60aec9a0..47f3530f 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,7 @@
11# - install Xdebug for PHPUnit code coverage reports: 11# - install Xdebug for PHPUnit code coverage reports:
12# - see http://xdebug.org/docs/install 12# - see http://xdebug.org/docs/install
13# - enable in php.ini 13# - enable in php.ini
14SHELL := /bin/bash
14 15
15BIN = vendor/bin 16BIN = vendor/bin
16PHP_SOURCE = index.php application tests plugins 17PHP_SOURCE = index.php application tests plugins
@@ -203,14 +204,18 @@ htmlsidebar:
203htmlpages: 204htmlpages:
204 @for file in `find doc/ -maxdepth 1 -name "*.md"`; do \ 205 @for file in `find doc/ -maxdepth 1 -name "*.md"`; do \
205 base=`basename $$file .md`; \ 206 base=`basename $$file .md`; \
206 sed -i "1i #$${base//-/ }" $$file; \ 207 sed -i "1i # $${base//-/ }" $$file; \
207 awk 'BEGIN { FS = "[\\[\\]]{2}" }'\ 208 awk 'BEGIN { FS = "[\\[\\]]{2}" }'\
208 'm = /\[/ { t=$$2; gsub(/ /, "-", $$2); print $$1"["t"]("$$2".html)"$$3 }'\ 209 'm = /\[/ { t=$$2; gsub(/ /, "-", $$2); print $$1"["t"]("$$2".html)"$$3 }'\
209 '!m { print $$0 }' $$file > doc/tmp.md; \ 210 '!m { print $$0 }' $$file > doc/tmp.md; \
210 mv doc/tmp.md $$file; \ 211 mv doc/tmp.md $$file; \
211 pandoc -f markdown_github -t html5 -s \ 212 pandoc -f gfm \
213 -t html5 \
214 -s \
212 -c "github-markdown.css" \ 215 -c "github-markdown.css" \
213 -T Shaarli -M pagetitle:"$${base//-/ }" -B doc/sidebar.html \ 216 -T Shaarli \
217 -M pagetitle:"$${base//-/ }" \
218 -B doc/sidebar.html \
214 -o doc/$$base.html $$file; \ 219 -o doc/$$base.html $$file; \
215 done; 220 done;
216 221
diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile
deleted file mode 100644
index d9ef8da7..00000000
--- a/docker/development/Dockerfile
+++ /dev/null
@@ -1,38 +0,0 @@
1FROM debian:jessie
2MAINTAINER Shaarli Community
3
4ENV TERM dumb
5RUN apt-get update \
6 && apt-get install --no-install-recommends -y \
7 ca-certificates \
8 nginx-light \
9 php5-curl \
10 php5-fpm \
11 php5-gd \
12 php5-intl \
13 supervisor \
14 git \
15 nano \
16 && apt-get clean
17
18RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini
19RUN sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini
20COPY nginx.conf /etc/nginx/nginx.conf
21COPY supervised.conf /etc/supervisor/conf.d/supervised.conf
22
23ADD https://getcomposer.org/composer.phar /usr/local/bin/composer
24RUN chmod 755 /usr/local/bin/composer
25
26WORKDIR /var/www
27RUN git clone https://github.com/shaarli/Shaarli.git shaarli \
28 && cd shaarli \
29 && composer --prefer-dist install
30RUN rm -rf html \
31 && echo "<?php phpinfo(); ?>" > index.php \
32 && chown -R www-data:www-data .
33
34VOLUME /var/www/shaarli/data
35
36EXPOSE 80
37
38CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
diff --git a/docker/development/IMAGE.md b/docker/development/IMAGE.md
deleted file mode 100644
index e2ff0f0e..00000000
--- a/docker/development/IMAGE.md
+++ /dev/null
@@ -1,10 +0,0 @@
1## shaarli:dev
2- [Debian 8 Jessie](https://hub.docker.com/_/debian/)
3- [PHP5-FPM](http://php-fpm.org/)
4- [Nginx](http://nginx.org/)
5- [Shaarli](https://github.com/shaarli/Shaarli)
6
7### Development tools
8- [composer](https://getcomposer.org/)
9- [git](http://git-scm.com/)
10- [nano](http://www.nano-editor.org/)
diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile
deleted file mode 100644
index d0509115..00000000
--- a/docker/production/Dockerfile
+++ /dev/null
@@ -1,37 +0,0 @@
1FROM debian:jessie
2MAINTAINER Shaarli Community
3
4ENV TERM dumb
5RUN apt-get update \
6 && apt-get install --no-install-recommends -y \
7 ca-certificates \
8 curl \
9 nginx-light \
10 php5-curl \
11 php5-fpm \
12 php5-gd \
13 php5-intl \
14 supervisor \
15 && apt-get clean
16
17RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini
18RUN sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini
19COPY nginx.conf /etc/nginx/nginx.conf
20COPY supervised.conf /etc/supervisor/conf.d/supervised.conf
21
22ADD https://getcomposer.org/composer.phar /usr/local/bin/composer
23RUN chmod 755 /usr/local/bin/composer
24
25WORKDIR /var/www
26RUN curl -L https://github.com/shaarli/Shaarli/archive/master.tar.gz | tar xzf - \
27 && mv Shaarli-master shaarli \
28 && cd shaarli \
29 && composer --prefer-dist --no-dev install
30RUN rm -rf html \
31 && chown -R www-data:www-data .
32
33VOLUME /var/www/shaarli/data
34
35EXPOSE 80
36
37CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
diff --git a/docker/production/IMAGE.md b/docker/production/IMAGE.md
deleted file mode 100644
index 6f827b35..00000000
--- a/docker/production/IMAGE.md
+++ /dev/null
@@ -1,5 +0,0 @@
1## shaarli:latest
2- [Debian 8 Jessie](https://hub.docker.com/_/debian/)
3- [PHP5-FPM](http://php-fpm.org/)
4- [Nginx](http://nginx.org/)
5- [Shaarli](https://github.com/shaarli/Shaarli)
diff --git a/docker/production/nginx.conf b/docker/production/nginx.conf
deleted file mode 100644
index 5ffa02d0..00000000
--- a/docker/production/nginx.conf
+++ /dev/null
@@ -1,63 +0,0 @@
1user www-data www-data;
2daemon off;
3worker_processes 4;
4
5events {
6 worker_connections 768;
7}
8
9http {
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 ~ (index)\.php$ {
52 # filter and proxy PHP requests to PHP-FPM
53 fastcgi_pass unix:/var/run/php5-fpm.sock;
54 fastcgi_index index.php;
55 include fastcgi.conf;
56 }
57
58 location ~ \.php$ {
59 # deny access to all other PHP scripts
60 deny all;
61 }
62 }
63}
diff --git a/docker/production/stable/Dockerfile b/docker/production/stable/Dockerfile
deleted file mode 100644
index fc9588b0..00000000
--- a/docker/production/stable/Dockerfile
+++ /dev/null
@@ -1,37 +0,0 @@
1FROM debian:jessie
2MAINTAINER Shaarli Community
3
4ENV TERM dumb
5RUN apt-get update \
6 && apt-get install --no-install-recommends -y \
7 ca-certificates \
8 curl \
9 nginx-light \
10 php5-curl \
11 php5-fpm \
12 php5-gd \
13 php5-intl \
14 supervisor \
15 && apt-get clean
16
17RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini
18RUN sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini
19COPY nginx.conf /etc/nginx/nginx.conf
20COPY supervised.conf /etc/supervisor/conf.d/supervised.conf
21
22ADD https://getcomposer.org/composer.phar /usr/local/bin/composer
23RUN chmod 755 /usr/local/bin/composer
24
25WORKDIR /var/www
26RUN curl -L https://github.com/shaarli/Shaarli/archive/stable.tar.gz | tar xzf - \
27 && mv Shaarli-stable shaarli \
28 && cd shaarli \
29 && composer --prefer-dist --no-dev install
30RUN rm -rf html \
31 && chown -R www-data:www-data .
32
33VOLUME /var/www/shaarli/data
34
35EXPOSE 80
36
37CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
diff --git a/docker/production/stable/IMAGE.md b/docker/production/stable/IMAGE.md
deleted file mode 100644
index d85b1d7a..00000000
--- a/docker/production/stable/IMAGE.md
+++ /dev/null
@@ -1,5 +0,0 @@
1## shaarli:stable
2- [Debian 8 Jessie](https://hub.docker.com/_/debian/)
3- [PHP5-FPM](http://php-fpm.org/)
4- [Nginx](http://nginx.org/)
5- [Shaarli (stable)](https://github.com/shaarli/Shaarli/tree/stable)
diff --git a/docker/production/stable/nginx.conf b/docker/production/stable/nginx.conf
deleted file mode 100644
index 5ffa02d0..00000000
--- a/docker/production/stable/nginx.conf
+++ /dev/null
@@ -1,63 +0,0 @@
1user www-data www-data;
2daemon off;
3worker_processes 4;
4
5events {
6 worker_connections 768;
7}
8
9http {
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 ~ (index)\.php$ {
52 # filter and proxy PHP requests to PHP-FPM
53 fastcgi_pass unix:/var/run/php5-fpm.sock;
54 fastcgi_index index.php;
55 include fastcgi.conf;
56 }
57
58 location ~ \.php$ {
59 # deny access to all other PHP scripts
60 deny all;
61 }
62 }
63}
diff --git a/docker/production/stable/supervised.conf b/docker/production/stable/supervised.conf
deleted file mode 100644
index 5acd9795..00000000
--- a/docker/production/stable/supervised.conf
+++ /dev/null
@@ -1,13 +0,0 @@
1[program:php5-fpm]
2command=/usr/sbin/php5-fpm -F
3priority=5
4autostart=true
5autorestart=true
6
7[program:nginx]
8command=/usr/sbin/nginx
9priority=10
10autostart=true
11autorestart=true
12stdout_events_enabled=true
13stderr_events_enabled=true
diff --git a/docker/production/supervised.conf b/docker/production/supervised.conf
deleted file mode 100644
index 5acd9795..00000000
--- a/docker/production/supervised.conf
+++ /dev/null
@@ -1,13 +0,0 @@
1[program:php5-fpm]
2command=/usr/sbin/php5-fpm -F
3priority=5
4autostart=true
5autorestart=true
6
7[program:nginx]
8command=/usr/sbin/nginx
9priority=10
10autostart=true
11autorestart=true
12stdout_events_enabled=true
13stderr_events_enabled=true