diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1269488 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +data diff --git a/000-default.conf b/000-default.conf deleted file mode 100644 index 59ea0db..0000000 --- a/000-default.conf +++ /dev/null @@ -1,36 +0,0 @@ - - # The ServerName directive sets the request scheme, hostname and port that - # the server uses to identify itself. This is used when creating - # redirection URLs. In the context of virtual hosts, the ServerName - # specifies what hostname must appear in the request's Host: header to - # match this virtual host. For the default virtual host (this file) this - # value is not decisive as it is used as a last resort host regardless. - # However, you must set it for any further virtual host explicitly. - #ServerName www.example.com - - ServerAdmin webmaster@localhost - DocumentRoot /var/www - - # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, - # error, crit, alert, emerg. - # It is also possible to configure the loglevel for particular - # modules, e.g. - #LogLevel info ssl:warn - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - # For most configuration files from conf-available/, which are - # enabled or disabled at a global level, it is possible to - # include a line for only one particular virtual host. For example the - # following line enables the CGI configuration for this host only - # after it has been globally disabled with "a2disconf". - #Include conf-available/serve-cgi-bin.conf - - # MediaWiki Short URL - RedirectMatch ^/$ /wiki/ - RedirectMatch ^/wiki$ /wiki/ - Alias /wiki /var/www/w/index.php - - -# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/Dockerfile b/Dockerfile index b3486c7..cd2684d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,62 +1,16 @@ -# Mediawiki-Apache -# -# Version 1.2 - -FROM tutum/apache-php:latest +FROM mediawiki:latest MAINTAINER Adrian Malacoda # Install ImageMagick -RUN apt-get -y update && apt-get -y install imagemagick - -ARG MW_VERSION=REL1_30 +#RUN apt-get -y update && apt-get -y install imagemagick WORKDIR / -# Update composer -RUN composer self-update - -# 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 && mv /var/www/html /var/www/w && git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git /app -RUN cd /app && git checkout -b $MW_VERSION origin/$MW_VERSION && git submodule update --init - # Install extensions ADD add_extension.sh /add_extension.sh RUN chmod +x add_extension.sh -RUN ./add_extension.sh Renameuser $MW_VERSION && \ - ./add_extension.sh ImageMap $MW_VERSION && \ - ./add_extension.sh Cite $MW_VERSION && \ - ./add_extension.sh InputBox $MW_VERSION && \ - ./add_extension.sh LocalisationUpdate $MW_VERSION && \ - ./add_extension.sh Interwiki $MW_VERSION && \ - ./add_extension.sh TitleBlacklist $MW_VERSION && \ - ./add_extension.sh Gadgets $MW_VERSION && \ - ./add_extension.sh WikiEditor $MW_VERSION && \ - ./add_extension.sh SpamBlacklist $MW_VERSION && \ - ./add_extension.sh ParserFunctions $MW_VERSION && \ - ./add_extension.sh SyntaxHighlight_GeSHi $MW_VERSION && \ - ./add_extension.sh ConfirmEdit $MW_VERSION && \ - ./add_extension.sh Nuke $MW_VERSION && \ - ./add_extension.sh Poem $MW_VERSION && \ - ./add_extension.sh PdfHandler $MW_VERSION - -# Install skins -ADD add_skin.sh /add_skin.sh -RUN chmod +x add_skin.sh -RUN ./add_skin.sh Vector $MW_VERSION && \ - ./add_skin.sh MonoBook $MW_VERSION - -# Create the section for persistent files -RUN mkdir /var/lib/mediawiki -RUN ln -s /var/lib/mediawiki/LocalSettings.php /app/LocalSettings.php +RUN ./add_extension.sh Scribunto $MEDIAWIKI_BRANCH ADD setup.sh /setup.sh -RUN chmod +x setup.sh - -ADD 000-default.conf /etc/apache2/sites-available/000-default.conf - -# Install composer dependencies -RUN cd /app && composer install --no-dev - -EXPOSE 80 -CMD ./setup.sh && ./run.sh +RUN chmod +x /setup.sh +CMD ["/setup.sh"] diff --git a/add_extension.sh b/add_extension.sh index 9a24a3e..73d40e3 100644 --- a/add_extension.sh +++ b/add_extension.sh @@ -3,7 +3,7 @@ EXT_NAME=$1 EXT_VERSION=$2 -cd "app/extensions" +cd "/var/www/html/extensions" if [[ -e "${EXT_NAME}" ]]; then cp -Rv "${EXT_NAME}" . @@ -17,6 +17,12 @@ if [[ "${EXT_VERSION}" ]]; then git checkout -b "${EXT_VERSION}" "origin/${EXT_VERSION}" fi +if [[ -e ".git" ]]; then + git submodule update --init +fi + if [[ -e "composer.json" ]]; then composer install --no-dev fi + +chown -R www-data:www-data . diff --git a/add_skin.sh b/add_skin.sh index a80741e..ea5504d 100644 --- a/add_skin.sh +++ b/add_skin.sh @@ -3,7 +3,7 @@ EXT_NAME=$1 EXT_VERSION=$2 -cd /app/skins +cd "/var/www/html/skins" git clone https://gerrit.wikimedia.org/r/p/mediawiki/skins/$1 cd $1 git checkout -b $2 origin/$2 diff --git a/docker-compose.yml b/docker-compose.yml index fdfccf2..bf108de 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,8 @@ services: web: build: . volumes: - - ./data:/var/lib/mediawiki + - ./data/images:/var/www/html/images + - ./data/LocalSettings.php:/var/www/html/LocalSettings.php ports: - "8001:80" links: diff --git a/setup.sh b/setup.sh index c88ee90..70f8fc6 100644 --- a/setup.sh +++ b/setup.sh @@ -1,28 +1,11 @@ #!/bin/bash -if [[ ! -h /app/skins ]]; then - mkdir -p /var/lib/mediawiki/skins - cp -R /app/skins/* /var/lib/mediawiki/skins - rm -rf /app/skins - ln -s /var/lib/mediawiki/skins /app/skins -fi - -if [[ ! -h /app/extensions ]]; then - mkdir -p /var/lib/mediawiki/extensions - cp -R /app/extensions/* /var/lib/mediawiki/extensions - rm -rf /app/extensions - ln -s /var/lib/mediawiki/extensions /app/extensions -fi - -if [[ ! -h /app/images ]]; then - mkdir -p /var/lib/mediawiki/images - cp -R /app/images/* /var/lib/mediawiki/images - rm -rf /app/images - ln -s /var/lib/mediawiki/images /app/images -fi +HTML_ROOT=/var/www/html # Run updater if we have an existing install -if [[ -e /var/lib/mediawiki/LocalSettings.php ]]; then - cd /app/maintenance +if [[ -e "$HTML_ROOT/LocalSettings.php" ]]; then + cd "$HTML_ROOT/maintenance" php update.php fi + +apache2-foreground