MediaWiki-Docker/Configuration recipes/Customize base image

Sometimes we need to customize the base image used for mediawiki. For example, we may need to install additional packages. To do that follow the below steps:

Modify the mediawiki service in docker-compose.override.yaml as follows:

version: '3.7'
services:
  mediawiki:
    # On Linux, these lines ensure file ownership is set to your host user/group
    user: "${MW_DOCKER_UID}:${MW_DOCKER_GID}"
    build:
      context: ./path/to/custom/Dockerfile/Directory
      dockerfile: Dockerfile

In that custom Dockerfile, build everything on top of base image. Suppose, we want to install imagemagick

# Important: Make sure the version here matches the latest version in docker-compose.yml
FROM docker-registry.wikimedia.org/dev/stretch-php72-fpm-apache2-xdebug:0.6.1-s1

RUN apt update && \

   apt install -y imagemagick

# Add any additional image preparation code here.

The base image (e.g. stretch-php72-fpm-apache2-xdebug:0.6.1-s1 should match that used for the mediawiki service in the docker-compose.yml file.

You should run docker-compose build after changing this Dockerfile.