From 6a1a135392cfc3f828c31321ec730fa82ce089a5 Mon Sep 17 00:00:00 2001 From: Adrian Malacoda Date: Mon, 24 Nov 2014 00:41:30 -0600 Subject: [PATCH] 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. --- Dockerfile | 11 ++++++----- setup.sh | 6 ++++++ 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 setup.sh diff --git a/Dockerfile b/Dockerfile index 6d3ec8f..61d8ce3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,17 +5,18 @@ FROM tutum/apache-php:latest MAINTAINER John E Arnold +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 diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..65a4db4 --- /dev/null +++ b/setup.sh @@ -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