Merge pull request #46 from Ilyes512/dependabot/docker/golang-1.21.7-… #71
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: Build Images | |
on: | |
push: | |
branches: [main] | |
tags: ['*'] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build Image | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
arch: ['linux/amd64', 'linux/arm64'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Debug action | |
uses: hmarr/debug-action@v3 | |
- uses: hadolint/hadolint-action@v3.1.0 | |
- name: Image name | |
id: image_name | |
uses: ASzc/change-string-case-action@v6 | |
with: | |
string: ghcr.io/${{ github.repository }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
if: ${{ !(env.ACT || github.actor == 'dependabot[bot]') }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3.0.0 | |
with: | |
platforms: ${{ matrix.arch }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3.0.0 | |
- name: Docker meta (debian) | |
id: meta_debian | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ steps.image_name.outputs.lowercase }} | |
flavor: | | |
prefix=debian-,onlatest=true | |
tags: | | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr,prefix=debian-pr- | |
- name: Docker meta (scratch) | |
id: meta_scratch | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ steps.image_name.outputs.lowercase }} | |
flavor: | | |
onlatest=true | |
tags: | | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr,prefix=pr- | |
- name: Build and push (debian) | |
uses: docker/build-push-action@v5 | |
with: | |
push: ${{ !(env.ACT || github.actor == 'dependabot[bot]') }} | |
context: . | |
platforms: ${{ matrix.arch }} | |
target: debian | |
tags: ${{ steps.meta_debian.outputs.tags }} | |
labels: ${{ steps.meta_debian.outputs.labels }} | |
- name: Build and push (scratch) | |
uses: docker/build-push-action@v5 | |
with: | |
push: ${{ !(env.ACT || github.actor == 'dependabot[bot]') }} | |
context: . | |
platforms: ${{ matrix.arch }} | |
target: scratch | |
tags: ${{ steps.meta_scratch.outputs.tags }} | |
labels: ${{ steps.meta_scratch.outputs.labels }} | |