├── Dockerfile ├── LICENSE ├── README.md ├── nginx.conf ├── start.sh └── supervisord.conf /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | MAINTAINER Ilya Stepanov 3 | 4 | ENV DOKUWIKI_VERSION 2016-06-26a 5 | ENV MD5_CHECKSUM 9b9ad79421a1bdad9c133e859140f3f2 6 | 7 | RUN apk --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ add \ 8 | php7 php7-fpm php7-gd php7-session php7-xml nginx supervisor curl tar 9 | 10 | RUN mkdir -p /run/nginx && \ 11 | mkdir -p /var/www /var/dokuwiki-storage/data && \ 12 | cd /var/www && \ 13 | curl -O -L "https://download.dokuwiki.org/src/dokuwiki/dokuwiki-$DOKUWIKI_VERSION.tgz" && \ 14 | tar -xzf "dokuwiki-$DOKUWIKI_VERSION.tgz" --strip 1 && \ 15 | rm "dokuwiki-$DOKUWIKI_VERSION.tgz" && \ 16 | mv /var/www/data/pages /var/dokuwiki-storage/data/pages && \ 17 | ln -s /var/dokuwiki-storage/data/pages /var/www/data/pages && \ 18 | mv /var/www/data/meta /var/dokuwiki-storage/data/meta && \ 19 | ln -s /var/dokuwiki-storage/data/meta /var/www/data/meta && \ 20 | mv /var/www/data/media /var/dokuwiki-storage/data/media && \ 21 | ln -s /var/dokuwiki-storage/data/media /var/www/data/media && \ 22 | mv /var/www/data/media_attic /var/dokuwiki-storage/data/media_attic && \ 23 | ln -s /var/dokuwiki-storage/data/media_attic /var/www/data/media_attic && \ 24 | mv /var/www/data/media_meta /var/dokuwiki-storage/data/media_meta && \ 25 | ln -s /var/dokuwiki-storage/data/media_meta /var/www/data/media_meta && \ 26 | mv /var/www/data/attic /var/dokuwiki-storage/data/attic && \ 27 | ln -s /var/dokuwiki-storage/data/attic /var/www/data/attic && \ 28 | mv /var/www/conf /var/dokuwiki-storage/conf && \ 29 | ln -s /var/dokuwiki-storage/conf /var/www/conf 30 | 31 | ADD nginx.conf /etc/nginx/nginx.conf 32 | ADD supervisord.conf /etc/supervisord.conf 33 | ADD start.sh /start.sh 34 | 35 | RUN echo "cgi.fix_pathinfo = 0;" >> /etc/php7/php-fpm.ini && \ 36 | sed -i -e "s|;daemonize\s*=\s*yes|daemonize = no|g" /etc/php7/php-fpm.conf && \ 37 | sed -i -e "s|listen\s*=\s*127\.0\.0\.1:9000|listen = /var/run/php-fpm7.sock|g" /etc/php7/php-fpm.d/www.conf && \ 38 | sed -i -e "s|;listen\.owner\s*=\s*|listen.owner = |g" /etc/php7/php-fpm.d/www.conf && \ 39 | sed -i -e "s|;listen\.group\s*=\s*|listen.group = |g" /etc/php7/php-fpm.d/www.conf && \ 40 | sed -i -e "s|;listen\.mode\s*=\s*|listen.mode = |g" /etc/php7/php-fpm.d/www.conf && \ 41 | chmod +x /start.sh 42 | 43 | EXPOSE 80 44 | VOLUME ["/var/dokuwiki-storage"] 45 | 46 | CMD /start.sh 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2015 Ilya Stepanov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | istepanov/dokuwiki 2 | ================== 3 | 4 | ## THIS PROJECT IS NO LONGER MAINTAINED 5 | 6 | [![Docker Stars](https://img.shields.io/docker/stars/istepanov/dokuwiki.svg)](https://hub.docker.com/r/istepanov/dokuwiki/) 7 | [![Docker Pulls](https://img.shields.io/docker/pulls/istepanov/dokuwiki.svg)](https://hub.docker.com/r/istepanov/dokuwiki/) 8 | [![Docker Build](https://img.shields.io/docker/automated/istepanov/dokuwiki.svg)](https://hub.docker.com/r/istepanov/dokuwiki/) 9 | [![Layers](https://images.microbadger.com/badges/image/istepanov/dokuwiki.svg)](https://microbadger.com/images/istepanov/dokuwiki) 10 | [![Version](https://images.microbadger.com/badges/version/istepanov/dokuwiki.svg)](https://microbadger.com/images/istepanov/dokuwiki) 11 | [![Join the chat at https://gitter.im/istepanov/docker-dokuwiki](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/istepanov/docker-dokuwiki?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 12 | 13 | Docker container image with [DokuWiki](https://www.dokuwiki.org/dokuwiki) and nginx 14 | 15 | ### How to run 16 | 17 | Assume your docker host is localhost and HTTP public port is 8000 (change these values if you need). 18 | 19 | First, run new dokuwiki container: 20 | 21 | docker run -d -p 8000:80 --name dokuwiki istepanov/dokuwiki:2.0 22 | 23 | Then setup dokuwiki using installer at URL `http://localhost:8000/install.php` 24 | 25 | ### How to make data persistent 26 | 27 | To make sure data won't be deleted if container is removed, create an empty container named `dokuwiki-data` and attach DokuWiki container's volumes to it. Volumes won't be deleted if at least one container owns them. 28 | 29 | # create data container 30 | docker run --volumes-from dokuwiki --name dokuwiki-data busybox 31 | 32 | # now you can safely delete dokuwiki container 33 | docker stop dokuwiki && docker rm dokuwiki 34 | 35 | # to restore dokuwiki, create new dokuwiki container and attach dokuwiki-data volume to it 36 | docker run -d -p 8000:80 --volumes-from dokuwiki-data --name dokuwiki istepanov/dokuwiki:2.0 37 | 38 | ### Persistent plugins 39 | 40 | Dokuwiki installs plugins to `lib/plugins/`, but this folder isn't inside persistent volume storage by default, so all plugins will be erased when container is re-created. The recommended way to make plugins persistent is to create your own Docker image with `istepanov/dokuwiki` as a base image and use shell commands inside the Dockerfile to install needed plugins. 41 | 42 | Example (install [Dokuwiki ToDo](https://www.dokuwiki.org/plugin:todo) plugin): 43 | 44 | FROM istepanov/dokuwiki 45 | MAINTAINER Ilya Stepanov 46 | 47 | # this is an example Dockerfile that demonstrates how to add Dokuwiki plugins to istepanov/dokuwiki image 48 | 49 | RUN apt-get update && \ 50 | apt-get install -y unzip && \ 51 | apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 52 | 53 | # add todo plugin 54 | RUN curl -O -L "https://github.com/leibler/dokuwiki-plugin-todo/archive/stable.zip" && \ 55 | unzip stable.zip -d /var/www/lib/plugins/ && \ 56 | mv /var/www/lib/plugins/dokuwiki-plugin-todo-stable /var/www/lib/plugins/todo && \ 57 | rm -rf stable.zip 58 | 59 | ### How to backup data 60 | 61 | # create dokuwiki-backup.tar.gz archive in current directory using temporaty container 62 | docker run --rm --volumes-from dokuwiki -v $(pwd):/backup ubuntu tar zcvf /backup/dokuwiki-backup.tar.gz /var/dokuwiki-storage 63 | 64 | **Note:** only these folders are backed up: 65 | 66 | * `data/pages/` 67 | * `data/meta/` 68 | * `data/media/` 69 | * `data/media_attic/` 70 | * `data/media_meta/` 71 | * `data/attic/` 72 | * `conf/` 73 | 74 | ### How to restore from backup 75 | 76 | #create new dokuwiki container, but don't start it yet 77 | docker create -p 8000:80 --name dokuwiki istepanov/dokuwiki:2.0 78 | 79 | # create data container for persistency (optional) 80 | docker run --volumes-from dokuwiki --name dokuwiki-data busybox 81 | 82 | # restore from backup using temporary container 83 | docker run --rm --volumes-from dokuwiki -w / -v $(pwd):/backup ubuntu tar xzvf /backup/dokuwiki-backup.tar.gz 84 | 85 | # start dokuwiki 86 | docker start dokuwiki 87 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | daemon off; 2 | 3 | user nobody; 4 | worker_processes 1; 5 | 6 | error_log stderr error; 7 | 8 | events { 9 | worker_connections 1024; 10 | } 11 | 12 | http { 13 | include mime.types; 14 | default_type application/octet-stream; 15 | 16 | #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 17 | # '$status $body_bytes_sent "$http_referer" ' 18 | # '"$http_user_agent" "$http_x_forwarded_for"'; 19 | 20 | #access_log logs/access.log main; 21 | 22 | sendfile on; 23 | #tcp_nopush on; 24 | 25 | #keepalive_timeout 0; 26 | keepalive_timeout 65; 27 | 28 | #gzip on; 29 | 30 | server { 31 | listen 80; 32 | 33 | root /var/www; 34 | index index.php index.html index.htm; 35 | 36 | client_max_body_size 2M; 37 | client_body_buffer_size 128k; 38 | 39 | location / { 40 | index doku.php; 41 | try_files $uri $uri/ @dokuwiki; 42 | } 43 | 44 | location @dokuwiki { 45 | rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last; 46 | rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last; 47 | rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last; 48 | rewrite ^/(.*) /doku.php?id=$1 last; 49 | } 50 | 51 | location ~ \.php$ { 52 | try_files $uri =404; 53 | fastcgi_pass unix:/var/run/php-fpm7.sock; 54 | fastcgi_index index.php; 55 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 56 | include fastcgi_params; 57 | } 58 | 59 | location ~ /\.ht { 60 | deny all; 61 | } 62 | 63 | location ~ /(data|conf|bin|inc)/ { 64 | deny all; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | chown -R nobody /var/www 6 | chown -R nobody /var/dokuwiki-storage 7 | 8 | su -s /bin/sh nobody -c 'php7 /var/www/bin/indexer.php -c' 9 | 10 | exec /usr/bin/supervisord -c /etc/supervisord.conf 11 | -------------------------------------------------------------------------------- /supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon=true 3 | 4 | [supervisorctl] 5 | serverurl=unix:///var/run/supervisor.sock 6 | 7 | [unix_http_server] 8 | file=/var/run/supervisor.sock 9 | 10 | [rpcinterface:supervisor] 11 | supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface 12 | 13 | [program:php] 14 | command=/usr/sbin/php-fpm7 15 | stdout_logfile=/dev/stdout 16 | stdout_logfile_maxbytes=0 17 | redirect_stderr=true 18 | 19 | [program:nginx] 20 | command=/usr/sbin/nginx 21 | stdout_logfile=/dev/stdout 22 | stdout_logfile_maxbytes=0 23 | redirect_stderr=true 24 | --------------------------------------------------------------------------------