Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions arm7hf-1.24/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM armhf/php:5.6-apache
MAINTAINER Synctree App Force <appforce+docker@synctree.com>

ENV MEDIAWIKI_VERSION 1.24
ENV MEDIAWIKI_FULL_VERSION 1.24.2

RUN set -x; \
apt-get update \
&& apt-get install -y --no-install-recommends \
g++ \
libicu52 \
libicu-dev \
&& pecl install intl \
&& echo extension=intl.so >> /usr/local/etc/php/conf.d/ext-intl.ini \
&& apt-get purge -y --auto-remove g++ libicu-dev \
&& rm -rf /var/lib/apt/lists/*

RUN docker-php-ext-install mysqli opcache

RUN set -x; \
apt-get update \
&& apt-get install -y --no-install-recommends imagemagick \
&& rm -rf /var/lib/apt/lists/*

RUN a2enmod rewrite

# https://www.mediawiki.org/keys/keys.txt
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys \
441276E9CCD15F44F6D97D18C119E1A64D70938E \
41B2ABE817ADD3E52BDA946F72BC1C5D23107F8A \
162432D9E81C1C618B301EECEE1F663462D84F01 \
1D98867E82982C8FE0ABC25F9B69B3109D3BB7B0 \
3CEF8262806D3F0B6BA1DBDD7956EE477F901A30 \
280DB7845A1DCAC92BB5A00A946B02565DC00AA7

RUN MEDIAWIKI_DOWNLOAD_URL="https://releases.wikimedia.org/mediawiki/$MEDIAWIKI_VERSION/mediawiki-$MEDIAWIKI_FULL_VERSION.tar.gz"; \
set -x; \
mkdir -p /usr/src/mediawiki \
&& curl -fSL "$MEDIAWIKI_DOWNLOAD_URL" -o mediawiki.tar.gz \
&& curl -fSL "${MEDIAWIKI_DOWNLOAD_URL}.sig" -o mediawiki.tar.gz.sig \
&& gpg --verify mediawiki.tar.gz.sig \
&& tar -xf mediawiki.tar.gz -C /usr/src/mediawiki --strip-components=1


COPY apache/mediawiki.conf /etc/apache2/
RUN echo Include /etc/apache2/mediawiki.conf >> /etc/apache2/apache2.conf

COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]
44 changes: 44 additions & 0 deletions arm7hf-1.24/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# What is MediaWiki?

MediaWiki is a free and open-source wiki app, used to power wiki websites such
as Wikipedia, Wiktionary and Commons, developed by the Wikimedia Foundation and
others.

> [wikipedia.org/wiki/MediaWiki](https://en.wikipedia.org/wiki/MediaWiki)

# How to use this image

docker run --name some-mediawiki --link some-mysql:mysql -d spwilson2/mediawiki

The following environment variables are also honored for configuring your
MediaWiki instance:

- `-e MEDIAWIKI_DB_HOST=ADDR:PORT` (defaults to the address and port of the
linked mysql container)
- `-e MEDIAWIKI_DB_USER=...` (defaults to "root")
- `-e MEDIAWIKI_DB_PASSWORD=...` (defaults to the value of the
`MYSQL_ROOT_PASSWORD` environment variable from the linked mysql container)
- `-e MEDIAWIKI_DB_NAME=...` (defaults to "mediawiki")

If the `MEDIAWIKI_DB_NAME` specified does not already exist in the given MySQL
container, it will be created automatically upon container startup, provided
that the `MEDIAWIKI_DB_USER` specified has the necessary permissions to create
it.

To use with an external database server, use `MEDIAWIKI_DB_HOST` (along with
`MEDIAWIKI_DB_USER` and `MEDIAWIKI_DB_PASSWORD` if necessary):

docker run --name some-mediawiki -e MEDIAWIKI_DB_HOST=10.0.0.1:3306 \
-e MEDIAWIKI_DB_USER=app -e MEDIAWIKI_DB_PASSWORD=secure spwilson2/rpi-mediawiki

If you'd like to be able to access the instance from the host without the
container's IP, standard port mappings can be used:

docker run --name some-mediawiki --link some-mysql:mysql -p 8080:80 -d spwilson2/rpi-mediawiki

Then, access it via `http://localhost:8080` or `http://host-ip:8080` in a browser.

Once you have set up your media wiki, you'll need to add the LocalSettings.php file output to
the docker container.

docker run --name some-mediawiki -v /path/on-docker-host/to/LocalSettings.php:/var/www-shared/html/LocalSettings.php --link some-mysql:mysql -d spwilson2/rpi-mediawiki
19 changes: 19 additions & 0 deletions arm7hf-1.24/apache/mediawiki.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Directory /var/www/html>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</Directory>

<Directory /var/www/html/images>
# Ignore .htaccess files
AllowOverride None

# Serve HTML as plaintext, don't execute SHTML
AddType text/plain .html .htm .shtml .php

# Don't run arbitrary PHP code.
php_admin_flag engine off
</Directory>
84 changes: 84 additions & 0 deletions arm7hf-1.24/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/bash

set -e

: ${MEDIAWIKI_SITE_NAME:=MediaWiki}

if [ -z "$MEDIAWIKI_DB_HOST" -a -z "$MYSQL_PORT_3306_TCP" ]; then
echo >&2 'error: missing MYSQL_PORT_3306_TCP environment variable'
echo >&2 ' Did you forget to --link some_mysql_container:mysql ?'
exit 1
fi

# if we're linked to MySQL, and we're using the root user, and our linked
# container has a default "root" password set up and passed through... :)
: ${MEDIAWIKI_DB_USER:=root}
if [ "$MEDIAWIKI_DB_USER" = 'root' ]; then
: ${MEDIAWIKI_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD}
fi
: ${MEDIAWIKI_DB_NAME:=mediawiki}

if [ -z "$MEDIAWIKI_DB_PASSWORD" ]; then
echo >&2 'error: missing required MEDIAWIKI_DB_PASSWORD environment variable'
echo >&2 ' Did you forget to -e MEDIAWIKI_DB_PASSWORD=... ?'
echo >&2
echo >&2 ' (Also of interest might be MEDIAWIKI_DB_USER and MEDIAWIKI_DB_NAME.)'
exit 1
fi

if ! [ -e index.php -a -e includes/DefaultSettings.php ]; then
echo >&2 "MediaWiki not found in $(pwd) - copying now..."

if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A; sleep 10 )
fi
tar cf - --one-file-system -C /usr/src/mediawiki . | tar xf -
echo >&2 "Complete! MediaWiki has been successfully copied to $(pwd)"
fi

: ${MEDIAWIKI_SHARED:=/var/www-shared/html}
if [ -d "$MEDIAWIKI_SHARED" ]; then
# If there is no LocalSettings.php but we have one under the shared
# directory, symlink it
if [ -e "$MEDIAWIKI_SHARED/LocalSettings.php" -a ! -e LocalSettings.php ]; then
ln -s "$MEDIAWIKI_SHARED/LocalSettings.php" LocalSettings.php
fi

# If the images directory only contains a README, then link it to
# $MEDIAWIKI_SHARED/images, creating the shared directory if necessary
if [ "$(ls images)" = "README" -a ! -L images ]; then
rm -fr images
mkdir -p "$MEDIAWIKI_SHARED/images"
ln -s "$MEDIAWIKI_SHARED/images" images
fi
fi

: ${MEDIAWIKI_DB_HOST:=${MYSQL_PORT_3306_TCP#tcp://}}

TERM=dumb php -- "$MEDIAWIKI_DB_HOST" "$MEDIAWIKI_DB_USER" "$MEDIAWIKI_DB_PASSWORD" "$MEDIAWIKI_DB_NAME" <<'EOPHP'
<?php
// database might not exist, so let's try creating it (just to be safe)

list($host, $port) = explode(':', $argv[1], 2);
$mysql = new mysqli($host, $argv[2], $argv[3], '', (int)$port);

if ($mysql->connect_error) {
file_put_contents('php://stderr', 'MySQL Connection Error: (' . $mysql->connect_errno . ') ' . $mysql->connect_error . "\n");
exit(1);
}

if (!$mysql->query('CREATE DATABASE IF NOT EXISTS `' . $mysql->real_escape_string($argv[4]) . '`')) {
file_put_contents('php://stderr', 'MySQL "CREATE DATABASE" Error: ' . $mysql->error . "\n");
$mysql->close();
exit(1);
}

$mysql->close();
EOPHP

chown -R www-data: .

export MEDIAWIKI_SITE_NAME MEDIAWIKI_DB_HOST MEDIAWIKI_DB_USER MEDIAWIKI_DB_PASSWORD MEDIAWIKI_DB_NAME

exec "$@"
57 changes: 57 additions & 0 deletions arm7hf-1.26/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM armhf/php:7.0-apache
MAINTAINER Sean Wilson <spwilson27@gmail.com>

ENV MEDIAWIKI_VERSION 1.26
ENV MEDIAWIKI_FULL_VERSION 1.26.2

#TODO: Look at these
RUN set -x; \
apt-get update \
&& apt-get install -y --no-install-recommends \
g++ \
libicu52 \
libicu-dev \
&& pecl install intl \
&& echo extension=intl.so >> /usr/local/etc/php/conf.d/ext-intl.ini \
&& apt-get purge -y --auto-remove g++ libicu-dev \
&& rm -rf /var/lib/apt/lists/*

#TODO: Whot is this
RUN docker-php-ext-install mysqli opcache

#TODO: Look at this.
RUN set -x; \
apt-get update \
&& apt-get install -y --no-install-recommends imagemagick \
&& rm -rf /var/lib/apt/lists/*

#TODO: Whot is this
RUN a2enmod rewrite

# https://www.mediawiki.org/keys/keys.txt
# TODO: Change
#RUN gpg --keyserver pool.sks-keyservers.net --recv-keys \
# 441276E9CCD15F44F6D97D18C119E1A64D70938E \
# 41B2ABE817ADD3E52BDA946F72BC1C5D23107F8A \
# 162432D9E81C1C618B301EECEE1F663462D84F01 \
# 1D98867E82982C8FE0ABC25F9B69B3109D3BB7B0 \
# 3CEF8262806D3F0B6BA1DBDD7956EE477F901A30 \
# 280DB7845A1DCAC92BB5A00A946B02565DC00AA7

RUN MEDIAWIKI_DOWNLOAD_URL="https://releases.wikimedia.org/mediawiki/$MEDIAWIKI_VERSION/mediawiki-$MEDIAWIKI_FULL_VERSION.tar.gz"; \
set -x; \
mkdir -p /usr/src/mediawiki \
&& curl -fSL "$MEDIAWIKI_DOWNLOAD_URL" -o mediawiki.tar.gz \
&& curl -fSL "${MEDIAWIKI_DOWNLOAD_URL}.sig" -o mediawiki.tar.gz.sig \
&& gpg --verify mediawiki.tar.gz.sig \
&& tar -xf mediawiki.tar.gz -C /usr/src/mediawiki --strip-components=1


#TODO: looks at this, looks good just try to understand
COPY apache/mediawiki.conf /etc/apache2/
RUN echo Include /etc/apache2/mediawiki.conf >> /etc/apache2/apache2.conf

COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
#TODO might need to change
CMD ["apache2-foreground"]
44 changes: 44 additions & 0 deletions arm7hf-1.26/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# What is MediaWiki?

MediaWiki is a free and open-source wiki app, used to power wiki websites such
as Wikipedia, Wiktionary and Commons, developed by the Wikimedia Foundation and
others.

> [wikipedia.org/wiki/MediaWiki](https://en.wikipedia.org/wiki/MediaWiki)

# How to use this image

docker run --name some-mediawiki --link some-mysql:mysql -d spwilson2/mediawiki

The following environment variables are also honored for configuring your
MediaWiki instance:

- `-e MEDIAWIKI_DB_HOST=ADDR:PORT` (defaults to the address and port of the
linked mysql container)
- `-e MEDIAWIKI_DB_USER=...` (defaults to "root")
- `-e MEDIAWIKI_DB_PASSWORD=...` (defaults to the value of the
`MYSQL_ROOT_PASSWORD` environment variable from the linked mysql container)
- `-e MEDIAWIKI_DB_NAME=...` (defaults to "mediawiki")

If the `MEDIAWIKI_DB_NAME` specified does not already exist in the given MySQL
container, it will be created automatically upon container startup, provided
that the `MEDIAWIKI_DB_USER` specified has the necessary permissions to create
it.

To use with an external database server, use `MEDIAWIKI_DB_HOST` (along with
`MEDIAWIKI_DB_USER` and `MEDIAWIKI_DB_PASSWORD` if necessary):

docker run --name some-mediawiki -e MEDIAWIKI_DB_HOST=10.0.0.1:3306 \
-e MEDIAWIKI_DB_USER=app -e MEDIAWIKI_DB_PASSWORD=secure spwilson2/rpi-mediawiki

If you'd like to be able to access the instance from the host without the
container's IP, standard port mappings can be used:

docker run --name some-mediawiki --link some-mysql:mysql -p 8080:80 -d spwilson2/rpi-mediawiki

Then, access it via `http://localhost:8080` or `http://host-ip:8080` in a browser.

Once you have set up your media wiki, you'll need to add the LocalSettings.php file output to
the docker container.

docker run --name some-mediawiki -v /path/on-docker-host/to/LocalSettings.php:/var/www-shared/html/LocalSettings.php --link some-mysql:mysql -d spwilson2/rpi-mediawiki
19 changes: 19 additions & 0 deletions arm7hf-1.26/apache/mediawiki.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Directory /var/www/html>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</Directory>

<Directory /var/www/html/images>
# Ignore .htaccess files
AllowOverride None

# Serve HTML as plaintext, don't execute SHTML
AddType text/plain .html .htm .shtml .php

# Don't run arbitrary PHP code.
php_admin_flag engine off
</Directory>
Loading