diff options
Diffstat (limited to 'docker/alpine')
-rw-r--r-- | docker/alpine/Dockerfile.master | 47 | ||||
-rw-r--r-- | docker/alpine/IMAGE.md | 5 | ||||
-rw-r--r-- | docker/alpine/nginx.conf | 73 | ||||
-rw-r--r-- | docker/alpine/php-fpm.conf | 16 | ||||
-rwxr-xr-x | docker/alpine/services.d/.s6-svscan/finish | 2 | ||||
-rwxr-xr-x | docker/alpine/services.d/nginx/run | 2 | ||||
-rwxr-xr-x | docker/alpine/services.d/php-fpm/run | 2 |
7 files changed, 147 insertions, 0 deletions
diff --git a/docker/alpine/Dockerfile.master b/docker/alpine/Dockerfile.master new file mode 100644 index 00000000..58f7c6e7 --- /dev/null +++ b/docker/alpine/Dockerfile.master | |||
@@ -0,0 +1,47 @@ | |||
1 | FROM alpine:3.6 | ||
2 | MAINTAINER Shaarli Community | ||
3 | |||
4 | RUN apk --update --no-cache add \ | ||
5 | ca-certificates \ | ||
6 | curl \ | ||
7 | nginx \ | ||
8 | php7 \ | ||
9 | php7-ctype \ | ||
10 | php7-curl \ | ||
11 | php7-fpm \ | ||
12 | php7-gd \ | ||
13 | php7-iconv \ | ||
14 | php7-intl \ | ||
15 | php7-json \ | ||
16 | php7-mbstring \ | ||
17 | php7-openssl \ | ||
18 | php7-phar \ | ||
19 | php7-session \ | ||
20 | php7-xml \ | ||
21 | php7-zlib \ | ||
22 | s6 | ||
23 | |||
24 | COPY nginx.conf /etc/nginx/nginx.conf | ||
25 | COPY php-fpm.conf /etc/php7/php-fpm.conf | ||
26 | COPY services.d /etc/services.d | ||
27 | |||
28 | RUN curl -sS https://getcomposer.org/installer | php7 -- --install-dir=/usr/local/bin --filename=composer \ | ||
29 | && rm -rf /etc/php7/php-fpm.d/www.conf \ | ||
30 | && sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php7/php.ini \ | ||
31 | && sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php7/php.ini | ||
32 | |||
33 | |||
34 | WORKDIR /var/www | ||
35 | RUN curl -L https://github.com/shaarli/Shaarli/archive/master.tar.gz | tar xzf - \ | ||
36 | && mv Shaarli-master shaarli \ | ||
37 | && cd shaarli \ | ||
38 | && composer --prefer-dist --no-dev install \ | ||
39 | && rm -rf ~/.composer \ | ||
40 | && chown -R nginx:nginx . | ||
41 | |||
42 | VOLUME /var/www/shaarli/data | ||
43 | |||
44 | EXPOSE 80 | ||
45 | |||
46 | ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] | ||
47 | CMD [] | ||
diff --git a/docker/alpine/IMAGE.md b/docker/alpine/IMAGE.md new file mode 100644 index 00000000..6f827b35 --- /dev/null +++ b/docker/alpine/IMAGE.md | |||
@@ -0,0 +1,5 @@ | |||
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/alpine/nginx.conf b/docker/alpine/nginx.conf new file mode 100644 index 00000000..07fba33f --- /dev/null +++ b/docker/alpine/nginx.conf | |||
@@ -0,0 +1,73 @@ | |||
1 | user nginx nginx; | ||
2 | daemon off; | ||
3 | worker_processes 4; | ||
4 | pid /var/run/nginx.pid; | ||
5 | |||
6 | events { | ||
7 | worker_connections 768; | ||
8 | } | ||
9 | |||
10 | http { | ||
11 | include mime.types; | ||
12 | default_type application/octet-stream; | ||
13 | keepalive_timeout 20; | ||
14 | |||
15 | client_max_body_size 10m; | ||
16 | |||
17 | index index.html index.php; | ||
18 | |||
19 | server { | ||
20 | listen 80; | ||
21 | root /var/www/shaarli; | ||
22 | |||
23 | access_log /var/log/nginx/shaarli.access.log; | ||
24 | error_log /var/log/nginx/shaarli.error.log; | ||
25 | |||
26 | location ~ /\. { | ||
27 | # deny access to dotfiles | ||
28 | access_log off; | ||
29 | log_not_found off; | ||
30 | deny all; | ||
31 | } | ||
32 | |||
33 | location ~ ~$ { | ||
34 | # deny access to temp editor files, e.g. "script.php~" | ||
35 | access_log off; | ||
36 | log_not_found off; | ||
37 | deny all; | ||
38 | } | ||
39 | |||
40 | location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { | ||
41 | # cache static assets | ||
42 | expires max; | ||
43 | add_header Pragma public; | ||
44 | add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | ||
45 | } | ||
46 | |||
47 | location = /favicon.ico { | ||
48 | # serve the Shaarli favicon from its custom location | ||
49 | alias /var/www/shaarli/images/favicon.ico; | ||
50 | } | ||
51 | |||
52 | location / { | ||
53 | # Slim - rewrite URLs | ||
54 | try_files $uri /index.php$is_args$args; | ||
55 | } | ||
56 | |||
57 | location ~ (index)\.php$ { | ||
58 | # Slim - split URL path into (script_filename, path_info) | ||
59 | try_files $uri =404; | ||
60 | fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
61 | |||
62 | # filter and proxy PHP requests to PHP-FPM | ||
63 | fastcgi_pass unix:/var/run/php-fpm.sock; | ||
64 | fastcgi_index index.php; | ||
65 | include fastcgi.conf; | ||
66 | } | ||
67 | |||
68 | location ~ \.php$ { | ||
69 | # deny access to all other PHP scripts | ||
70 | deny all; | ||
71 | } | ||
72 | } | ||
73 | } | ||
diff --git a/docker/alpine/php-fpm.conf b/docker/alpine/php-fpm.conf new file mode 100644 index 00000000..0843c164 --- /dev/null +++ b/docker/alpine/php-fpm.conf | |||
@@ -0,0 +1,16 @@ | |||
1 | [global] | ||
2 | daemonize = no | ||
3 | |||
4 | [www] | ||
5 | user = nginx | ||
6 | group = nginx | ||
7 | listen.owner = nginx | ||
8 | listen.group = nginx | ||
9 | catch_workers_output = yes | ||
10 | listen = /var/run/php-fpm.sock | ||
11 | pm = dynamic | ||
12 | pm.max_children = 20 | ||
13 | pm.start_servers = 1 | ||
14 | pm.min_spare_servers = 1 | ||
15 | pm.max_spare_servers = 3 | ||
16 | pm.max_requests = 2048 | ||
diff --git a/docker/alpine/services.d/.s6-svscan/finish b/docker/alpine/services.d/.s6-svscan/finish new file mode 100755 index 00000000..1dadeeaf --- /dev/null +++ b/docker/alpine/services.d/.s6-svscan/finish | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | /bin/true | ||
diff --git a/docker/alpine/services.d/nginx/run b/docker/alpine/services.d/nginx/run new file mode 100755 index 00000000..21e7b0d6 --- /dev/null +++ b/docker/alpine/services.d/nginx/run | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/execlineb -P | ||
2 | nginx | ||
diff --git a/docker/alpine/services.d/php-fpm/run b/docker/alpine/services.d/php-fpm/run new file mode 100755 index 00000000..21dd0107 --- /dev/null +++ b/docker/alpine/services.d/php-fpm/run | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/execlineb -P | ||
2 | php-fpm7 -F | ||