diff --git a/mattermost/web/Dockerfile b/mattermost/web/Dockerfile index a138e0cb3563643c0be52c8d5eb3ab7f7bf5ba3e..d9ddad500fbbc752266d08ae01450274da557ea3 100644 --- a/mattermost/web/Dockerfile +++ b/mattermost/web/Dockerfile @@ -2,7 +2,7 @@ FROM nginx:mainline-alpine # Remove default configuration and add our custom Nginx configuration files RUN rm /etc/nginx/conf.d/default.conf \ - && apk add --no-cache curl + && apk --no-cache add curl COPY ["./mattermost", "./mattermost-ssl", "/etc/nginx/sites-available/"] COPY ./security.conf /etc/nginx/conf.d/ diff --git a/pica-dokuwiki/Dockerfile b/pica-dokuwiki/Dockerfile index 143379a92eee650ece25d94d86d39206a4f9961d..d8e10dd718c5b1bd3f7c89ffeab741d35010c880 100644 --- a/pica-dokuwiki/Dockerfile +++ b/pica-dokuwiki/Dockerfile @@ -1,15 +1,34 @@ -FROM registry.picasoft.net:5000/pica-nginx -MAINTAINER antoine@barbare.me +FROM nginx +LABEL maintainer="antoine@barbare.me" -RUN cd /var/www && \ - curl -O -L "https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz" && \ - tar -xzf dokuwiki-stable.tgz -C html --strip-components 1 && \ - rm -Rf dokuwiki* +COPY --chown=www-data nginx.conf /etc/nginx/nginx.conf +COPY --chown=www-data run.sh / -COPY nginx.conf /etc/nginx/nginx.conf -COPY entrypoint.sh /entrypoint.sh +WORKDIR /var/www +RUN apt-get update -y && \ + apt-get install -y \ + wget \ + tar \ + php7.0 \ + php7.0-fpm \ + php7.0-gd \ + php7.0-xml && \ + mkdir -p html /var/run/php && \ + echo "cgi.fix_pathinfo = 0;" >> /etc/php/7.0/fpm/php.ini && \ + sed -i -e "s|;daemonize\s*=\s*yes|daemonize = no|g" /etc/php/7.0/fpm/php-fpm.conf && \ + sed -i -e "s|listen\s*=\s*127\.0\.0\.1:9000|listen = /var/run/php-fpm7.sock|g" /etc/php/7.0/fpm/pool.d/www.conf && \ + sed -i -e "s|;listen\.owner\s*=\s*|listen.owner = |g" /etc/php/7.0/fpm/pool.d/www.conf && \ + sed -i -e "s|;listen\.group\s*=\s*|listen.group = |g" /etc/php/7.0/fpm/pool.d/www.conf && \ + sed -i -e "s|;listen\.mode\s*=\s*|listen.mode = |g" /etc/php/7.0/fpm/pool.d/www.conf && \ + wget "https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz" && \ + tar -xzf dokuwiki-stable.tgz -C html --strip-components 1 && \ + rm -f dokuwiki-stable.tgz && \ + chown -R www-data . && \ + chmod +x /run.sh && \ + sed -i "s/\${MAXSIZE}/100M/g" /etc/nginx/nginx.conf EXPOSE 80 VOLUME ["/var/www/html"] +HEALTHCHECK CMD wget -q -O /dev/null http://127.0.0.1:${DOKUWIKI_PORT:=80}/ -ENTRYPOINT ["/entrypoint.sh"] +CMD ["/run.sh"] diff --git a/pica-dokuwiki/docker-compose.yml b/pica-dokuwiki/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..02ef29cb444a63ee6670409fd1aaaba4ccc1d908 --- /dev/null +++ b/pica-dokuwiki/docker-compose.yml @@ -0,0 +1,18 @@ +version : "2.4" +services: + wiki: + container_name: wiki + image: pica-dokuwiki:2018.05 + volumes: + - /DATA/docker/wiki/html:/var/www/html + security_opt: + - no-new-privileges + mem_limit: 2048m + cpus: "0.20" + pids_limit: 1024 + labels: + - "traefik.frontend.rule=Host:wiki.picasoft.net" + - "traefik.port=80" + - "traefik.enable=true" + restart: always + diff --git a/pica-dokuwiki/entrypoint.sh b/pica-dokuwiki/entrypoint.sh deleted file mode 100755 index d1e1f6b0c09ba7e4d717c5efdd244dd08e34645a..0000000000000000000000000000000000000000 --- a/pica-dokuwiki/entrypoint.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -MAX_UPLOAD_SIZE=${MAX_UPLOAD_SIZE:-10M} -sed -i "s/\${MAXSIZE}/$MAX_UPLOAD_SIZE/g" /etc/nginx/nginx.conf -/start.sh diff --git a/pica-dokuwiki/nginx.conf b/pica-dokuwiki/nginx.conf index 37685f1738549f764a90e922b072864475b1a72d..cf2e58bf7bf12666b14928b1f82d459876744ed3 100644 --- a/pica-dokuwiki/nginx.conf +++ b/pica-dokuwiki/nginx.conf @@ -3,7 +3,7 @@ daemon off; user www-data; worker_processes 1; -error_log stderr error; +error_log stderr error; events { worker_connections 1024; @@ -14,13 +14,9 @@ http { default_type application/octet-stream; sendfile on; - #tcp_nopush on; - #keepalive_timeout 0; keepalive_timeout 65; - #gzip on; - server { listen 80; @@ -35,14 +31,7 @@ http { try_files $uri $uri/ @dokuwiki; } - #location @dokuwiki { - # rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last; - # rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last; - # rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last; - # rewrite ^/(.*) /doku.php?id=$1 last; - #} - - location ~ \.php$ { + location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; diff --git a/pica-dokuwiki/run.sh b/pica-dokuwiki/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..5433076a73fedfab639a97447894eafb38e86b6e --- /dev/null +++ b/pica-dokuwiki/run.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# EXPLAINING THE SCRIPT run.sh +# This is a poor man's supervisord. The only thing this script does is watching its forked (background) processes and as soon as one dies, it terminates all the others and exits with the code of the first dying process. +# see : https://github.com/dinkel/docker-nginx-phpfpm + +set -m + +php-fpm7.0 & +nginx & + +pids=`jobs -p` + +exitcode=0 + +function terminate() { + trap "" CHLD + + for pid in $pids; do + if ! kill -0 $pid 2>/dev/null; then + wait $pid + exitcode=$? + fi + done + + kill $pids 2>/dev/null +} + +trap terminate CHLD +wait + +exit $exitcode