Skip to content

Commit

Permalink
ci: simplify docker pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Apr 22, 2024
1 parent 587e20f commit 09e1263
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions .github/workflows/base-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ env:

jobs:
build:
name: Build PHP ${{ matrix.php-version }} for ${{ matrix.arch }}
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'buildjet-2vcpu-ubuntu-2204-arm' }}
name: Build PHP ${{ matrix.php-version }}
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ "8.3", "8.2", "8.1"]
arch: [ "amd64", "arm64" ]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Login into Github Docker Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

Expand All @@ -34,26 +36,10 @@ jobs:
context: .
push: true
file: Dockerfile.base
platforms: linux/${{ matrix.arch }}
tags: "ghcr.io/friendsofshopware/shopware-cli-base:${{ matrix.php-version }}-${{ matrix.arch }}"
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/friendsofshopware/shopware-cli-base:${{ matrix.php-version }}"
build-args: |
PHP_VERSION=${{ matrix.php-version }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false

merge:
name: Merge Image (${{ matrix.php-version }})
runs-on: ubuntu-latest
needs:
- build
strategy:
matrix:
php-version: [ "8.3", "8.2", "8.1"]
steps:
- name: Login into Github Docker Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- run: docker manifest create ghcr.io/friendsofshopware/shopware-cli-base:${{ matrix.php-version }} --amend ghcr.io/friendsofshopware/shopware-cli-base:${{ matrix.php-version }}-amd64 --amend ghcr.io/friendsofshopware/shopware-cli-base:${{ matrix.php-version }}-arm64

- run: docker manifest push ghcr.io/friendsofshopware/shopware-cli-base:${{ matrix.php-version }}

0 comments on commit 09e1263

Please sign in to comment.