build: add image-build action #1
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: Lagoon Image Build - buildx | |
on: | |
push: | |
branches: | |
- 'gh_actions**' | |
pull_request: | |
branches: | |
- 'gh_actions**' | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build | |
uses: docker/bake-action@v6 | |
env: | |
PLATFORMS: "linux/amd64,linux/arm64" | |
TAG: "gh_actions" | |
with: | |
files: | | |
./docker-bake.hcl | |
targets: default | |
push: true | |
set: | | |
*.cache-from=type=gha | |
*.cache-to=type=gha,mode=max |