diff --git a/pica-dokuwiki/Dockerfile b/pica-dokuwiki/Dockerfile index 62c5d36b60c777956a8cdf40f70431128dd21d25..33b8000f5de019e7c6ca3fc5d83124236040bfe2 100644 --- a/pica-dokuwiki/Dockerfile +++ b/pica-dokuwiki/Dockerfile @@ -1,41 +1,38 @@ FROM nginx LABEL maintainer="antoine@barbare.me" +COPY nginx.conf /etc/nginx/nginx.conf + WORKDIR /var/www RUN apt-get update -y && \ apt-get install -y \ - curl \ + wget \ tar \ php7.0 \ php7.0-fpm \ php7.0-gd \ - php7.0-xml \ - libidn2-0 && \ - mkdir -p html && \ + 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 && \ - curl -O -L "https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz" && \ + 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 nginx:nginx html && \ - apt-get remove curl -y && \ - apt-get -y autoclean && \ - apt-get -y clean && \ - apt-get -y autoremove + chown -R www-data . /etc/nginx/nginx.conf && \ + sed -i "s/\${MAXSIZE}/100M/g" /etc/nginx/nginx.conf && \ + ln -sf /dev/stdout /var/log/nginx/access.log && \ + ln -sf /dev/stderr /var/log/nginx/error.log && \ + ln -sf /dev/stderr /var/log/php-fpm.log -USER nginx EXPOSE 80 VOLUME ["/var/www/html"] HEALTHCHECK CMD wget -q -O /dev/null http://127.0.0.1:${DOKUWIKI_PORT:=80}/ -COPY nginx.conf /etc/nginx/nginx.conf +COPY run.sh / +COPY entrypoint.sh / -COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] - -COPY run.sh /run.sh -CMD ["run.sh"] \ No newline at end of file diff --git a/pica-dokuwiki/docker-compose.yml b/pica-dokuwiki/docker-compose.yml index 3b144b57bf65d5311c3fd5d1f398502585748764..2307479ec96182dad03419e9723ab78692b046cd 100644 --- a/pica-dokuwiki/docker-compose.yml +++ b/pica-dokuwiki/docker-compose.yml @@ -5,15 +5,13 @@ services: image: 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.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 index b28f4475bb9268d2579e5a60de92ba43b87f8997..1dbb845066d19d296d41360ee8e375bb50bd0c44 100755 --- a/pica-dokuwiki/entrypoint.sh +++ b/pica-dokuwiki/entrypoint.sh @@ -1,4 +1,5 @@ #!/bin/bash -MAX_UPLOAD_SIZE=${MAX_UPLOAD_SIZE:-10M} -sed -i "s/\${MAXSIZE}/$MAX_UPLOAD_SIZE/g" /etc/nginx/nginx.conf \ No newline at end of file +set -e +chmod +x /run.sh +/run.sh diff --git a/pica-dokuwiki/nginx.conf b/pica-dokuwiki/nginx.conf index b32b5901ffcffb2a9cea811a138708558d7658c9..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; @@ -62,4 +51,4 @@ http { deny all; } } -} \ No newline at end of file +} diff --git a/pica-dokuwiki/run.sh b/pica-dokuwiki/run.sh index 9f434c7652e392cf7a17b8e5001601fcb916e302..3b4ad57a85f986700350ddd51f377e363e808de2 100644 --- 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` @@ -29,4 +29,4 @@ function terminate() { trap terminate CHLD wait -exit $exitcode \ No newline at end of file +exit $exitcode