Skip to content

Commit

Permalink
add mediawiki configs
Browse files Browse the repository at this point in the history
  • Loading branch information
lillian committed Jan 13, 2024
1 parent 58cd76b commit 32f552d
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/mediawiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build mediawiki Docker image

on:
- push
- pull_request

jobs:
deploy:
runs-on: ubuntu-latest
if: github.repository == 'hacklabto/web-infra'
steps:
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- uses: docker/build-push-action@v2
with:
# https://github.com/docker/build-push-action/issues/378
context: docker/mediawiki/
file: docker/mediawiki/Dockerfile
push: true
tags: |
ghcr.io/mediawiki/mediawiki:${{ github.sha }}
cache-from: type=registry,ref=ghcr.io/hacklabto/mediawiki:${{ env.BRANCH_NAME }}
cache-to: type=inline
20 changes: 20 additions & 0 deletions docker/mediawiki/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ghcr.io/hacklabto/unit-base:f1708a6ec77445ecde3e4c363645df7c03dc241b

# todo: this image is _way_ too big

RUN sed -i 's#set -e"#(cd /app/mediawiki && php maintenance/run.php update)\n\n&#' docker-entrypoint.sh

RUN wget -O - https://releases.wikimedia.org/mediawiki/1.41/mediawiki-1.41.0.tar.gz | tar xz && mv mediawiki-1.41.0 mediawiki

# todo: these links contain a git commit id and will fail to download if the latest commit changed

RUN (cd mediawiki/skins && wget -O - https://extdist.wmflabs.org/dist/skins/Modern-REL1_41-fcf8856.tar.gz | tar xz)
RUN (cd mediawiki/skins && wget -O - https://extdist.wmflabs.org/dist/skins/CologneBlue-REL1_41-b4b4c96.tar.gz | tar xz)
RUN (cd mediawiki/extensions && wget -O - https://extdist.wmflabs.org/dist/extensions/MobileFrontend-REL1_41-2cd7976.tar.gz | tar xz)
RUN (cd mediawiki/extensions && wget -O - https://extdist.wmflabs.org/dist/extensions/Auth_remoteuser-REL1_41-cf8b45e.tar.gz | tar xz)
RUN (cd mediawiki/extensions && wget -O - https://github.com/Universal-Omega/DynamicPageList3/archive/REL1_39.tar.gz | tar xz && mv DynamicPageList3-REL1_39 DynamicPageList3)

COPY config.json /app/config.json

# mount /app/mediawiki/LocalSettings.php:ro
# mount /app/mediawiki/images/:rw
95 changes: 95 additions & 0 deletions docker/mediawiki/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"listeners": {
"0.0.0.0:8080": {
"pass": "routes/mediawiki"
}
},

"routes": {
"mediawiki": [
{
"match": {
"uri": [
"!/tests/qunit/*",
"/cache/*",
"/includes/*",
"/languages/*",
"/maintenance/*",
"/tests/*",
"/vendor/*"
]
},

"action": {
"return": 404
}
},
{
"match": {
"uri": [
"/api.php*",
"/img_auth.php*",
"/index.php*",
"/load.php*",
"/mw-config/*.php",
"/opensearch_desc.php*",
"/profileinfo.php*",
"/rest.php*",
"/tests/qunit/*.php",
"/thumb.php*",
"/thumb_handler.php*"
]
},

"action": {
"pass": "applications/mediawiki/direct"
}
},
{
"match": {
"uri": [
"!*.php",
"!*.json",
"!*.htaccess",
"/extensions/*",
"/images/*",
"/resources/assets/*",
"/resources/lib/*",
"/resources/src/*",
"/skins/*"
]
},

"action": {
"share": "/app/mediawiki$uri"
}
},
{
"action": {
"pass": "applications/mediawiki/index"
}
}
]
},

"applications": {
"mediawiki": {
"type": "php",
"targets": {
"direct": {
"root": "/app/mediawiki"
},

"index": {
"root": "/app/mediawiki",
"script": "index.php"
}
},
"processes": {
"idle_timeout": 30,
"max": 50,
"spare": 1
}
}
}
}

0 comments on commit 32f552d

Please sign in to comment.