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.yml 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
  mediawiki-web:
    user: "${MW_DOCKER_UID}:${MW_DOCKER_GID}"

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 of the mediawiki image in docker-compose.yml
FROM docker-registry.wikimedia.org/dev/buster-php81-fpm:1.0.0

RUN apt update && \

   apt install -y imagemagick

# Add any additional image preparation code here.

The base image (e.g. buster-php81-fpm:1.0.0 should match that used for the mediawiki service in the docker-compose.yml file.

You should run docker compose build after changing this Dockerfile.