We need to set up the volume when the container runs, not when it is built, because mounting a volume over /var/lib/mediawiki will shadow the contents of that directory in the image.

This commit is contained in:
Adrian Malacoda
2014-11-24 00:41:30 -06:00
parent c90fd0d343
commit 6a1a135392
2 changed files with 12 additions and 5 deletions

View File

@@ -5,17 +5,18 @@
FROM tutum/apache-php:latest
MAINTAINER John E Arnold <iohannes.eduardus.arnold@gmail.com>
WORKDIR /
# Remove the old hello world app and grab Mediawiki source
RUN apt-get update && apt-get install -yq git && rm -rf /var/lib/apt/lists/*
RUN rm -fr /app && git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git /app
RUN cd /app && git checkout -b REL1_23 origin/REL1_23
# Create the section for persistent files
RUN mkdir /var/lib/mediawiki
# Move the files that need to be persistent and create symbolic links to them
RUN mv /app/images /var/lib/mediawiki/ && ln -s /var/lib/mediawiki/images /app/images
RUN mv /app/skins /var/lib/mediawiki/ && ln -s /var/lib/mediawiki/skins /app/skins
RUN touch /var/lib/mediawiki/LocalSettings.php && ln -s /var/lib/mediawiki/LocalSettings.php /app/LocalSettings.php
ADD setup.sh /setup.sh
RUN chmod +x setup.sh
EXPOSE 80
CMD ["/run.sh"]
CMD ./setup.sh && ./run.sh

6
setup.sh Normal file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
if [[ ! -d /var/lib/mediawiki/skins ]]; then
mv /app/images /var/lib/mediawiki/ && ln -s /var/lib/mediawiki/images /app/images
mv /app/skins /var/lib/mediawiki/ && ln -s /var/lib/mediawiki/skins /app/skins
fi