1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-16 03:48:44 +00:00

add dokuwiki

This commit is contained in:
kev 2014-12-17 15:34:20 +08:00
parent 6280d16fc7
commit 32692c6878
4 changed files with 131 additions and 0 deletions

29
dokuwiki/Dockerfile Normal file

@ -0,0 +1,29 @@
FROM ubuntu:14.04
MAINTAINER Ilya Stepanov <dev@ilyastepanov.com>
RUN apt-get update && \
apt-get install -y nginx php5-fpm php5-gd curl && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /var/www
RUN cd /var/www && curl http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz | tar xz --strip 1
RUN chown -R www-data:www-data /var/www
RUN echo "cgi.fix_pathinfo = 0;" >> /etc/php5/fpm/php.ini
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN rm /etc/nginx/sites-enabled/*
ADD dokuwiki.conf /etc/nginx/sites-enabled/
EXPOSE 80
VOLUME [ \
"/var/www/data/pages", \
"/var/www/data/meta", \
"/var/www/data/media", \
"/var/www/data/media_attic", \
"/var/www/data/media_meta", \
"/var/www/data/attic", \
"/var/www/conf", \
"/var/log" \
]
CMD /usr/sbin/php5-fpm && /usr/sbin/nginx

22
dokuwiki/LICENSE Normal file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Ilya Stepanov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

46
dokuwiki/README.md Normal file

@ -0,0 +1,46 @@
docker-dokuwiki
===============
Docker container image with [DokuWiki](https://www.dokuwiki.org/dokuwiki) and nginx
###How to run
Assume your docker host is localhost and HTTP public port is 8000 (change these values if you need).
First, run new dokuwiki container:
docker run -d -p 8000:80 --name dokuwiki istepanov/dokuwiki
Then setup dokuwiki using installer at URL `http://localhost:8000/install.php`
###How to make data persistent
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.
# create data container
docker run --volumes-from dokuwiki --name dokuwiki-data busybox
# now you can safely delete dokuwiki container
docker stop dokuwiki && docker rm dokuwiki
# to restore dokuwiki, create new dokuwiki container and attach dokuwiki-data volume to it
docker run -d -p 8000:80 --volumes-from dokuwiki-data --name dokuwiki istepanov/dokuwiki
###How to backup data
# create dokuwiki-backup.tar.gz archive in current directory using temporaty container
docker run --rm --volumes-from dokuwiki -v $(pwd):/backup ubuntu tar zcvf /backup/dokuwiki-backup.tar.gz /var/www
###How to restore from backup
#create new dokuwiki container, but don't start it yet
docker create -p 8000:80 --name dokuwiki istepanov/dokuwiki
# create data container for persistency (optional)
docker run --volumes-from dokuwiki --name dokuwiki-data busybox
# restore from backup using temporary container
docker run --rm --volumes-from dokuwiki -w / -v $(pwd):/backup ubuntu tar xzvf /backup/dokuwiki-backup.tar.gz
# start dokuwiki
docker start dokuwiki

34
dokuwiki/dokuwiki.conf Normal file

@ -0,0 +1,34 @@
server {
listen 80;
root /var/www;
index index.php index.html index.htm;
location / {
index doku.php;
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$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location ~ /(data|conf|bin|inc)/ {
deny all;
}
}