How to best add extensions when using official docker image for MediaWiki?

后端 未结 1 1357
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-08 22:18

We are using the official MediaWiki Docker image and want to be able to add additional MediaWiki extensions.

Questions:

  1. What is the recommended next step
1条回答
  •  一生所求
    2021-02-08 22:21

    As OP suggested, you need to create an image which wraps the official MediaWiki image.

    Write instructions to make an image with extra extensions

    As a minimal example we'll create an image which includes the EmbedVideo extension, which is not bundled with MediaWiki as of version 1.31. Add the following instructions the file my-mediawiki/Dockerfile:

    FROM mediawiki:latest
    
    RUN git clone --depth 1 https://github.com/HydraWiki/mediawiki-embedvideo.git /var/www/html/extensions/EmbedVideo
    

    Build the image

    Turn this Dockerfile into an image using docker build:

    $ docker build -t username/mediawiki ./my-mediawiki
    Sending build context to Docker daemon  2.048kB
    Step 1/2 : FROM mediawiki:latest
    latest: Pulling from library/mediawiki
    802b00ed6f79: Pull complete
    # [lines omitted]
    8b47ece631d8: Pull complete 
    Digest: sha256:5922653b254073c6d6a535bbdb0101f8a5eadbf557e2f31d590c234001c55b60
    Status: Downloaded newer image for mediawiki:latest
     ---> 27fe73856ca7
    Step 2/2 : RUN git clone --depth 1 https://github.com/HydraWiki/mediawiki-embedvideo.git /var/www/html/extensions/EmbedVideo
     ---> Running in 30a411511341
    Cloning into '/var/www/html/extensions/EmbedVideo'...
    Removing intermediate container 30a411511341
     ---> 5b297228bb08
    Successfully built 5b297228bb08
    Successfully tagged username/mediawiki:latest
    

    Test the image

    Test the image using docker run:

    $ docker run --rm -p 8080:80 username/mediawiki
    

    While this container is running visit localhost:8080 with a web browser. You will be asked to perform the setup procedure. When you get to the options page the EmbedVideo extension will be included in the list of extensions.

    Perform the rest of setup

    Other steps are needed to get MediaWiki running in docker, such as providing a LocalSettings.php file and connecting it to a database. Follow the official MediaWiki Docker documentation for these steps, substituting your username/mediawiki image for the official mediawiki image.

    Add additional plugins

    Multiple plugins can be installed by appending more RUN instructions to the end of my-mediawiki/Dockerfile. For example, to add Scribunto, append the following to the bottom of the file:

    RUN git clone --depth 1 -b $MEDIAWIKI_BRANCH \
          https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Scribunto \
          /var/www/html/extensions/Scribunto \
          && chmod a+x /var/www/html/extensions/Scribunto/includes/engines/LuaStandalone/binaries/lua*_linux_*/lua
    

    After modifying the Dockerfile update the image using:

    docker build -t username/mediawiki ./my-mediawiki
    

    Most extensions require you to modify LocalSettings.php, and like Scribunto some will require additional installation commands to be run after download (check each extensions's README). Complex extensions like VisualEditor will require additional containers to run daemons such as Parsoid. My own Dockerfile and docker-compose.yml illustrate how other plugins can be configured.

    0 讨论(0)
提交回复
热议问题