Dockerfile: #148
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI to Docker Hub | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
mediawiki_version: ['1.42', '1.41', '1.40', '1.39'] | |
php_version: ['8.2', '8.1'] | |
target_repository: ['mediawiki', 'mediawiki-ci'] | |
include: | |
# set global default php | |
- php_default: '8.1' | |
# set 1.35 default php | |
# - php_default: '7.4' | |
# mediawiki_version: '1.35' | |
exclude: | |
- php_version: '8.2' | |
mediawiki_version: '1.39' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Docker setup | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: network=host | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache/${{ matrix.mediawiki_version }}/${{ matrix.database_type }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
# Env setup | |
- name: Retrieve MediaWiki version | |
run: | | |
source ./helpers.sh | |
echo "MEDIAWIKI_FULL_VERSION=$(mediawiki_version ${{matrix.mediawiki_version}})" >> $GITHUB_ENV | |
- name: generate tags for image | |
run: | | |
source ./helpers.sh | |
echo "TAGS=$(generate_tags gesinn/${{ matrix.target_repository }} ${{env.MEDIAWIKI_FULL_VERSION}} ${{matrix.mediawiki_version}} ${{matrix.php_version}} ${{matrix.php_default}})" >> $GITHUB_ENV | |
# Image build | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
network: host | |
allow: network.host | |
build-args: | | |
MEDIAWIKI_VERSION=${{ env.MEDIAWIKI_FULL_VERSION }} | |
PHP_VERSION=${{ matrix.php_version }} | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
tags: ${{ env.TAGS }} | |
target: ${{ matrix.target_repository }} | |
cache-from: type=local,src=/tmp/.buildx-cache/${{ matrix.mediawiki_version }}/${{ matrix.database_type }} | |
cache-to: type=local,dest=/tmp/.buildx-cache/${{ matrix.mediawiki_version }}/${{ matrix.database_type }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |