Skip to content

Commit

Permalink
[WIP] docker: switch to Alpine Linux
Browse files Browse the repository at this point in the history
Closes shaarli#843

Changed:
- switch base image from Debian:Jessie to Alpine:3.6
- switch to PHP 7.1
- switch from supervisord to s6 to manage services

WIP:
- `master` image

TODO:
- thorough testing of Shaarli pages and features
- `stable` image

FIXME:
- theme selection (invalid paths detected)

See:
- https://alpinelinux.org/
- https://wiki.alpinelinux.org/wiki/Nginx_with_PHP
- http://www.skarnet.org/software/s6/
  - http://www.skarnet.org/software/s6/s6-svscan.html
  - http://www.skarnet.org/software/s6/s6-svc.html
  - http://www.skarnet.org/software/s6/s6-svstat.html

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
  • Loading branch information
virtualtam committed Sep 19, 2017
1 parent 0cba184 commit 5a9e5f4
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 53 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ check_permissions:
@echo "----------------------"
@echo "Check file permissions"
@echo "----------------------"
@for file in `git ls-files`; do \
@for file in `git ls-files | grep -v docker`; do \
if [ -x $$file ]; then \
errors=true; \
echo "$${file} is executable"; \
Expand Down
47 changes: 47 additions & 0 deletions docker/master/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM alpine:3.6
MAINTAINER Shaarli Community

RUN apk --update --no-cache add \
ca-certificates \
curl \
nginx \
php7 \
php7-ctype \
php7-curl \
php7-fpm \
php7-gd \
php7-iconv \
php7-intl \
php7-json \
php7-mbstring \
php7-openssl \
php7-phar \
php7-session \
php7-xml \
php7-zlib \
s6

COPY nginx.conf /etc/nginx/nginx.conf
COPY php-fpm.conf /etc/php7/php-fpm.conf
COPY services.d /etc/services.d

RUN curl -sS https://getcomposer.org/installer | php7 -- --install-dir=/usr/local/bin --filename=composer \
&& rm -rf /etc/php7/php-fpm.d/www.conf \
&& sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php7/php.ini \
&& sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php7/php.ini


WORKDIR /var/www
RUN curl -L https://github.com/shaarli/Shaarli/archive/master.tar.gz | tar xzf - \
&& mv Shaarli-master shaarli \
&& cd shaarli \
&& composer --prefer-dist --no-dev install \
&& rm -rf ~/.composer \
&& chown -R nginx:nginx .

VOLUME /var/www/shaarli/data

EXPOSE 80

ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"]
CMD []
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
user www-data www-data;
user nginx nginx;
daemon off;
worker_processes 4;
pid /var/run/nginx.pid;

events {
worker_connections 768;
Expand Down Expand Up @@ -59,7 +60,7 @@ http {
fastcgi_split_path_info ^(.+\.php)(/.+)$;

# filter and proxy PHP requests to PHP-FPM
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
Expand Down
16 changes: 16 additions & 0 deletions docker/master/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[global]
daemonize = no

[www]
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx
catch_workers_output = yes
listen = /var/run/php-fpm.sock
pm = dynamic
pm.max_children = 20
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 2048
2 changes: 2 additions & 0 deletions docker/master/services.d/.s6-svscan/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
/bin/true
2 changes: 2 additions & 0 deletions docker/master/services.d/nginx/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/execlineb -P
nginx
2 changes: 2 additions & 0 deletions docker/master/services.d/php-fpm/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/execlineb -P
php-fpm7 -F
37 changes: 0 additions & 37 deletions docker/production/Dockerfile

This file was deleted.

13 changes: 0 additions & 13 deletions docker/production/supervised.conf

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5a9e5f4

Please sign in to comment.