diff --git a/dokuwiki/Dockerfile b/dokuwiki/Dockerfile index ad2ac16..c641e68 100644 --- a/dokuwiki/Dockerfile +++ b/dokuwiki/Dockerfile @@ -1,19 +1,18 @@ # -# Dockerfile for DokuWiki -# -# References -# - https://github.com/docker-library/drupal/blob/master/8/Dockerfile -# - https://www.dokuwiki.org/faq:backup +# Dockerfile for dokuwiki # -FROM php:5.6-apache +FROM alpine MAINTAINER kev WORKDIR /var/www/html -RUN a2enmod rewrite -RUN curl "http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz" | tar xz --strip 1 -RUN chown -R www-data:www-data . +RUN apk add -U nginx php-fpm tar \ + && wget -O- http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz | tar xz --strip 1 \ + && chown -R nobody:nobody . \ + && rm -rf /var/cache/apk/* + +COPY nginx.conf /etc/nginx/nginx.conf VOLUME /var/www/html/data/pages \ /var/www/html/data/meta \ @@ -23,3 +22,6 @@ VOLUME /var/www/html/data/pages \ /var/www/html/data/attic \ /var/www/html/conf +EXPOSE 80 + +CMD php-fpm && nginx -g 'daemon off;' diff --git a/dokuwiki/Dockerfile.debian b/dokuwiki/Dockerfile.debian new file mode 100644 index 0000000..ad2ac16 --- /dev/null +++ b/dokuwiki/Dockerfile.debian @@ -0,0 +1,25 @@ +# +# Dockerfile for DokuWiki +# +# References +# - https://github.com/docker-library/drupal/blob/master/8/Dockerfile +# - https://www.dokuwiki.org/faq:backup +# + +FROM php:5.6-apache +MAINTAINER kev + +WORKDIR /var/www/html + +RUN a2enmod rewrite +RUN curl "http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz" | tar xz --strip 1 +RUN chown -R www-data:www-data . + +VOLUME /var/www/html/data/pages \ + /var/www/html/data/meta \ + /var/www/html/data/media \ + /var/www/html/data/media_attic \ + /var/www/html/data/media_meta \ + /var/www/html/data/attic \ + /var/www/html/conf + diff --git a/dokuwiki/nginx.conf b/dokuwiki/nginx.conf new file mode 100644 index 0000000..47ec5f2 --- /dev/null +++ b/dokuwiki/nginx.conf @@ -0,0 +1,49 @@ +worker_processes 4; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + server_name _; + + client_max_body_size 4M; + client_body_buffer_size 128k; + + root /var/www/html; + index doku.php; + + location ~ /(data/|conf/|bin/|inc/) { deny all; } + + location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { + expires 31536000s; + add_header Pragma "public"; + add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate"; + log_not_found off; + } + + location / { 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&$args last; + } + + location ~ \.php$ { + try_files $uri $uri/ /doku.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param REDIRECT_STATUS 200; + fastcgi_pass 127.0.0.1:9000; + } + } +}