diff --git a/pica-dokuwiki/Dockerfile b/pica-dokuwiki/Dockerfile index 94f78146cd17b7f15d8e98545d5693a0313a39e7..d8e10dd718c5b1bd3f7c89ffeab741d35010c880 100644 --- a/pica-dokuwiki/Dockerfile +++ b/pica-dokuwiki/Dockerfile @@ -1,46 +1,34 @@ FROM nginx LABEL maintainer="antoine@barbare.me" +COPY --chown=www-data nginx.conf /etc/nginx/nginx.conf +COPY --chown=www-data run.sh / + WORKDIR /var/www -RUN apt-get update -y \ +RUN apt-get update -y && \ apt-get install -y \ - curl \ - tar \ - php7.0 \ - php7.0-fpm \ - php7.0-gd \ - php7.0-xml; \ - mkdir -p html; \ - chown -R nginx:nginx /var/www/html - - -USER nginx -COPY nginx.conf /etc/nginx/nginx.conf - -RUN 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; \ - curl -O -L "https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz" && \ + 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 -Rf dokuwiki* + rm -f dokuwiki-stable.tgz && \ + chown -R www-data . && \ + chmod +x /run.sh && \ + sed -i "s/\${MAXSIZE}/100M/g" /etc/nginx/nginx.conf -USER root -RUN apt-get remove -y tar && \ - apt-get -y autoclean && \ - apt-get -y clean && \ - apt-get -y autoremove - -USER nginx EXPOSE 80 VOLUME ["/var/www/html"] -HEALTHCHECK CMD curl -s 127.0.0.1:${DOKUWIKI_PORT:=80} - -COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] - -COPY run.sh /run.sh -CMD ["run.sh"] +HEALTHCHECK CMD wget -q -O /dev/null http://127.0.0.1:${DOKUWIKI_PORT:=80}/ +CMD ["/run.sh"] diff --git a/pica-dokuwiki/docker-compose.yml b/pica-dokuwiki/docker-compose.yml index 38cc770d22fbd3f922b3ae5af70cb19c8bf47550..2307479ec96182dad03419e9723ab78692b046cd 100644 --- a/pica-dokuwiki/docker-compose.yml +++ b/pica-dokuwiki/docker-compose.yml @@ -1,18 +1,18 @@ - wiki: - container_name: wiki - image: registry.picasoft.net:5000/pica-dokuwiki:2018.05 - volumes: - - /DATA/docker/wiki/html:/var/www/html - environment: - - MAX_UPLOAD_SIZE=100M - 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 +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.test.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 2f4431a4c546149fa0dbfc119ccfd06ebe686adc..0000000000000000000000000000000000000000 --- a/pica-dokuwiki/entrypoint.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -MAX_UPLOAD_SIZE=${MAX_UPLOAD_SIZE:-10M} -sed -i "s/\${MAXSIZE}/$MAX_UPLOAD_SIZE/g" /etc/nginx/nginx.conf 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 index f47135194f456d0c69d07c847ca4e123b7df6fa4..5433076a73fedfab639a97447894eafb38e86b6e 100755 --- a/pica-dokuwiki/run.sh +++ b/pica-dokuwiki/run.sh @@ -6,8 +6,8 @@ set -m -php7.0-fpm & -nginx -g "daemon off;" & +php-fpm7.0 & +nginx & pids=`jobs -p`