Skip to content

add arch

add arch #20

Workflow file for this run

name: alpine-base
on:
pull_request:
branches:
- main
paths:
- 'alpine.Dockerfile'
- '.github/workflows/base-build.yml'
push:
branches:
- main
paths:
- 'alpine.Dockerfile'
- '.github/workflows/base-build.yml'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
platform: ["linux/amd64", "linux/arm64"]
name: ["base"]
distro: ["alpine", "arch"]
go_version: ["1.20.8"]
steps:
- name: Checkout
uses: actions/checkout@v3
# https://docs.docker.com/build/ci/github-actions/multi-platform/
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
# https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the github container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
images: |
ghcr.io/${{ github.repository }}/${{ matrix.name }}
${{ secrets.DOCKERHUB_USER }}/${{ matrix.name }}
tags: |
type=sha
type=raw,value=${{ matrix.os }}${{ matrix.os_version }},enable={{ is_default_branch }}
- name: Build docker image
uses: docker/build-push-action@v4
with:
target: ${{ matrix.name }}
file: ${{ matrix.distro }}.Dockerfile
platforms: ${{ matrix.platform }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }}
labels: ${{ env.DOCKER_METADATA_OUTPUT_LABELS }}
build-args: |
GO_VERSION=${{ matrix.go_version }}
BUILDPLATFORM=${{ matrix.platform }}