prepare for gh cr builds

This commit is contained in:
conradschulz 2022-03-11 11:55:13 +01:00
parent 5a08498f3a
commit 154af0e111
2 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,51 @@
name: Multiarch Build Docker CI for the rd13_media_wiki project
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # fetch depth 0 is required for nx commands to properly compare code against main branch
- name: Create local master branch to use as baseline
if: github.ref != 'refs/heads/master'
run: git branch master origin/master
- name: install buildx
if: github.ref == 'refs/heads/master'
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
# If Multiarch build this will be required for ARM builds
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v1
# with:
# platforms: linux/amd64,linux/arm/v7,linux/arm64
- name: Login to GitHub Container Registry
if: github.ref == 'refs/heads/master' || github.event.label.name == 'dependencies'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.RD13_MW_DOCKER_BUILD_TOKEN }}
- name: build the image
if: github.event.label.name == 'dependencies'
run: |
docker buildx build \
--platform linux/amd64 .
- name: build and pushthe image
if: github.ref == 'refs/heads/master'
run: |
docker buildx build --push \
--tag ghcr.io/c-schulz-rd13/rd13_media_wiki:latest \
--platform linux/amd64 .
# This line can be used for multiARCH builds
# --platform linux/amd64,linux/arm/v7,linux/arm64 .

View file

@ -5,6 +5,7 @@ version: '3'
services: services:
mediawiki: mediawiki:
#image: ghcr.io/c-schulz-rd13/rd13_media_wiki:latest
build: . build: .
ports: ports:
- '8090:80' - '8090:80'