From 90f12b12ca9a828e2aaf2535c09ec9c73ff1e2a6 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Fri, 12 Aug 2016 21:36:54 +0200 Subject: Docker: update dependencies, introduce Composer Relates to https://github.com/shaarli/Shaarli/issues/607 Relates to https://github.com/shaarli/Shaarli/pull/612 Relates to https://github.com/shaarli/Shaarli/pull/624 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Modifications: - [all][env] set $TERM=dumb to avoid debconf-related issues - [all][pkg] install ca-certificates - [all][pkg] cleanup APT cache after installing packages - [dev] refactor Dockerfile - [prod][master] refactor Dockerfile - [prod][master][php] use Composer to resolve PHP dependencies Signed-off-by: VirtualTam --- docker/development/Dockerfile | 30 +++++++++++++++++++----------- docker/production/Dockerfile | 23 +++++++++++++++++++---- 2 files changed, 38 insertions(+), 15 deletions(-) (limited to 'docker') diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile index 2ed59b89..0c19b085 100644 --- a/docker/development/Dockerfile +++ b/docker/development/Dockerfile @@ -1,26 +1,34 @@ FROM debian:jessie MAINTAINER Shaarli Community +ENV TERM dumb RUN apt-get update \ - && apt-get install -y \ - nginx-light php5-fpm php5-gd supervisor \ - git nano - -ADD https://getcomposer.org/composer.phar /usr/local/bin/composer -RUN chmod 755 /usr/local/bin/composer + && apt-get install --no-install-recommends -y \ + ca-certificates \ + nginx-light \ + php5-curl \ + php5-fpm \ + php5-gd \ + php5-intl \ + supervisor \ + git \ + nano \ + && apt-get clean COPY nginx.conf /etc/nginx/nginx.conf COPY supervised.conf /etc/supervisor/conf.d/supervised.conf -RUN echo "" > /var/www/index.php + +ADD https://getcomposer.org/composer.phar /usr/local/bin/composer +RUN chmod 755 /usr/local/bin/composer WORKDIR /var/www +RUN git clone https://github.com/shaarli/Shaarli.git shaarli \ + && cd shaarli \ + && composer --prefer-dist install RUN rm -rf html \ - && git clone https://github.com/shaarli/Shaarli.git shaarli \ + && echo "" > index.php \ && chown -R www-data:www-data . -WORKDIR /var/www/shaarli -RUN composer install - VOLUME /var/www/shaarli/data EXPOSE 80 diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index 3db4eb56..d93ed262 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -1,17 +1,32 @@ FROM debian:jessie MAINTAINER Shaarli Community +ENV TERM dumb RUN apt-get update \ - && apt-get install -y curl nginx-light php5-fpm php5-gd supervisor + && apt-get install --no-install-recommends -y \ + ca-certificates \ + curl \ + nginx-light \ + php5-curl \ + php5-fpm \ + php5-gd \ + php5-intl \ + supervisor \ + && apt-get clean COPY nginx.conf /etc/nginx/nginx.conf COPY supervised.conf /etc/supervisor/conf.d/supervised.conf +ADD https://getcomposer.org/composer.phar /usr/local/bin/composer +RUN chmod 755 /usr/local/bin/composer + WORKDIR /var/www -RUN rm -rf html \ - && curl -L https://github.com/shaarli/Shaarli/archive/master.tar.gz | tar xvzf - \ +RUN curl -L https://github.com/shaarli/Shaarli/archive/master.tar.gz | tar xzf - \ && mv Shaarli-master shaarli \ - && chown -R www-data:www-data shaarli + && cd shaarli \ + && composer --prefer-dist --no-dev install +RUN rm -rf html \ + && chown -R www-data:www-data . VOLUME /var/www/shaarli/data -- cgit v1.2.3 From 665279ec99d31c7d571f90bf0186edb268020bb8 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sun, 14 Aug 2016 16:20:06 +0200 Subject: Docker: update dependencies, introduce Composer Relates to https://github.com/shaarli/Shaarli/issues/607 Relates to https://github.com/shaarli/Shaarli/pull/612 Relates to https://github.com/shaarli/Shaarli/pull/624 Relates to https://github.com/shaarli/Shaarli/pull/633 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Modifications: - [prod][stable] refactor Dockerfile - [prod][stable] set $TERM=dumb to avoid debconf-related issues - [prod][stable] install ca-certificates - [prod][stable] cleanup APT cache after installing packages - [prod][stable] use Composer to resolve PHP dependencies Signed-off-by: VirtualTam --- docker/production/stable/Dockerfile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'docker') diff --git a/docker/production/stable/Dockerfile b/docker/production/stable/Dockerfile index 2bb3948c..178d1cef 100644 --- a/docker/production/stable/Dockerfile +++ b/docker/production/stable/Dockerfile @@ -1,17 +1,32 @@ FROM debian:jessie MAINTAINER Shaarli Community +ENV TERM dumb RUN apt-get update \ - && apt-get install -y curl nginx-light php5-fpm php5-gd supervisor + && apt-get install --no-install-recommends -y \ + ca-certificates \ + curl \ + nginx-light \ + php5-curl \ + php5-fpm \ + php5-gd \ + php5-intl \ + supervisor \ + && apt-get clean COPY nginx.conf /etc/nginx/nginx.conf COPY supervised.conf /etc/supervisor/conf.d/supervised.conf +ADD https://getcomposer.org/composer.phar /usr/local/bin/composer +RUN chmod 755 /usr/local/bin/composer + WORKDIR /var/www +RUN curl -L https://github.com/shaarli/Shaarli/archive/stable.tar.gz | tar xzf - \ + && mv Shaarli-stable shaarli + && cd shaarli \ + && composer --prefer-dist --no-dev install RUN rm -rf html \ - && curl -L https://github.com/shaarli/Shaarli/archive/stable.tar.gz | tar xvzf - \ - && mv Shaarli-stable shaarli \ - && chown -R www-data:www-data shaarli + && chown -R www-data:www-data . VOLUME /var/www/shaarli/data -- cgit v1.2.3 From 7329118e9cfb41e4db0d898183304fcb0b204f7b Mon Sep 17 00:00:00 2001 From: Gary Marigliano Date: Wed, 14 Sep 2016 11:08:11 +0200 Subject: Add a missing backslash in stable Dockerfile version --- docker/production/stable/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docker') diff --git a/docker/production/stable/Dockerfile b/docker/production/stable/Dockerfile index 178d1cef..a509fda6 100644 --- a/docker/production/stable/Dockerfile +++ b/docker/production/stable/Dockerfile @@ -22,7 +22,7 @@ RUN chmod 755 /usr/local/bin/composer WORKDIR /var/www RUN curl -L https://github.com/shaarli/Shaarli/archive/stable.tar.gz | tar xzf - \ - && mv Shaarli-stable shaarli + && mv Shaarli-stable shaarli \ && cd shaarli \ && composer --prefer-dist --no-dev install RUN rm -rf html \ -- cgit v1.2.3 From b7f8b874bb9f2028c29b1f22f893fabec2836de8 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 5 Nov 2016 19:51:03 +0100 Subject: Docker: set favicon location in nginx configuration Relates to https://github.com/shaarli/Shaarli/issues/681 Fixed: - nginx: set the favicon location See http://serverfault.com/a/352861 Signed-off-by: VirtualTam --- docker/development/nginx.conf | 5 +++++ docker/production/nginx.conf | 5 +++++ docker/production/stable/nginx.conf | 5 +++++ 3 files changed, 15 insertions(+) (limited to 'docker') diff --git a/docker/development/nginx.conf b/docker/development/nginx.conf index cda09b56..e714ee76 100644 --- a/docker/development/nginx.conf +++ b/docker/development/nginx.conf @@ -49,6 +49,11 @@ http { add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } + location = /favicon.ico { + # serve the Shaarli favicon from its custom location + alias /var/www/shaarli/images/favicon.ico; + } + location ~ (index)\.php$ { # filter and proxy PHP requests to PHP-FPM fastcgi_pass unix:/var/run/php5-fpm.sock; diff --git a/docker/production/nginx.conf b/docker/production/nginx.conf index e23c4587..f7d59fc8 100644 --- a/docker/production/nginx.conf +++ b/docker/production/nginx.conf @@ -41,6 +41,11 @@ http { add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } + location = /favicon.ico { + # serve the Shaarli favicon from its custom location + alias /var/www/shaarli/images/favicon.ico; + } + location ~ (index)\.php$ { # filter and proxy PHP requests to PHP-FPM fastcgi_pass unix:/var/run/php5-fpm.sock; diff --git a/docker/production/stable/nginx.conf b/docker/production/stable/nginx.conf index e23c4587..f7d59fc8 100644 --- a/docker/production/stable/nginx.conf +++ b/docker/production/stable/nginx.conf @@ -41,6 +41,11 @@ http { add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } + location = /favicon.ico { + # serve the Shaarli favicon from its custom location + alias /var/www/shaarli/images/favicon.ico; + } + location ~ (index)\.php$ { # filter and proxy PHP requests to PHP-FPM fastcgi_pass unix:/var/run/php5-fpm.sock; -- cgit v1.2.3 From 68579ad5c4d1978366c5d2be2ef34da6a3618ef0 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 5 Nov 2016 20:42:54 +0100 Subject: Docker: increase maximum file upload size to 10 MiB Relates to https://github.com/shaarli/Shaarli/issues/681 Changed: - nginx+php-fpm: set maximum upload size to 10 MiB See: - https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size - https://secure.php.net/manual/en/ini.core.php#ini.post-max-size - https://secure.php.net/manual/en/ini.core.php#ini.upload-max-filesize Signed-off-by: VirtualTam --- docker/development/Dockerfile | 2 ++ docker/development/nginx.conf | 2 ++ docker/production/Dockerfile | 2 ++ docker/production/nginx.conf | 2 ++ docker/production/stable/Dockerfile | 2 ++ docker/production/stable/nginx.conf | 2 ++ 6 files changed, 12 insertions(+) (limited to 'docker') diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile index 0c19b085..d9ef8da7 100644 --- a/docker/development/Dockerfile +++ b/docker/development/Dockerfile @@ -15,6 +15,8 @@ RUN apt-get update \ nano \ && apt-get clean +RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini +RUN sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini COPY nginx.conf /etc/nginx/nginx.conf COPY supervised.conf /etc/supervisor/conf.d/supervised.conf diff --git a/docker/development/nginx.conf b/docker/development/nginx.conf index e714ee76..ac0c6c61 100644 --- a/docker/development/nginx.conf +++ b/docker/development/nginx.conf @@ -11,6 +11,8 @@ http { default_type application/octet-stream; keepalive_timeout 20; + client_max_body_size 10m; + index index.html index.php; server { diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index d93ed262..d0509115 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -14,6 +14,8 @@ RUN apt-get update \ supervisor \ && apt-get clean +RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini +RUN sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini COPY nginx.conf /etc/nginx/nginx.conf COPY supervised.conf /etc/supervisor/conf.d/supervised.conf diff --git a/docker/production/nginx.conf b/docker/production/nginx.conf index f7d59fc8..5ffa02d0 100644 --- a/docker/production/nginx.conf +++ b/docker/production/nginx.conf @@ -11,6 +11,8 @@ http { default_type application/octet-stream; keepalive_timeout 20; + client_max_body_size 10m; + index index.html index.php; server { diff --git a/docker/production/stable/Dockerfile b/docker/production/stable/Dockerfile index a509fda6..fc9588b0 100644 --- a/docker/production/stable/Dockerfile +++ b/docker/production/stable/Dockerfile @@ -14,6 +14,8 @@ RUN apt-get update \ supervisor \ && apt-get clean +RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini +RUN sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini COPY nginx.conf /etc/nginx/nginx.conf COPY supervised.conf /etc/supervisor/conf.d/supervised.conf diff --git a/docker/production/stable/nginx.conf b/docker/production/stable/nginx.conf index f7d59fc8..5ffa02d0 100644 --- a/docker/production/stable/nginx.conf +++ b/docker/production/stable/nginx.conf @@ -11,6 +11,8 @@ http { default_type application/octet-stream; keepalive_timeout 20; + client_max_body_size 10m; + index index.html index.php; server { -- cgit v1.2.3 From 5ebc1d504bc8a8f29f49a8a4fc1c421f78677b2a Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 3 Nov 2016 13:59:18 +0100 Subject: .htaccess files: support Apache 2.4+ syntax If `mod_version` is enabled, the previous syntax will apply for Apache <2.4. If not, the new syntax is used by default. Fixes #676 `mod_version` identifier is `version_module` across all Apache versions. See: * https://httpd.apache.org/docs/current/mod/mod_version.html * https://httpd.apache.org/docs/2.2/mod/mod_version.html * https://serverfault.com/questions/733910/how-do-i-load-mod-version-only-if-it-isnt-built-in-to-apache Note that version_module comes built-in with Debian (and derivatives) Apache2 packages, see https://wiki.debian.org/Apache/PackagingFor24 --- docker/.htaccess | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'docker') diff --git a/docker/.htaccess b/docker/.htaccess index b584d98c..f601c1ee 100644 --- a/docker/.htaccess +++ b/docker/.htaccess @@ -1,2 +1,13 @@ -Allow from none -Deny from all + + = 2.4> + Require all denied + + + Allow from none + Deny from all + + + + + Require all denied + -- cgit v1.2.3