Merge pull request #57 from spectrapulse/main
ci: add ARM64 as a supported container image architecture
This commit is contained in:
commit
a21d78e86c
83
.github/workflows/image.yml
vendored
83
.github/workflows/image.yml
vendored
@ -1,18 +1,83 @@
|
|||||||
name: Build container image
|
name: Build and publish container images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push: { branches: [ main ] }
|
||||||
branches:
|
|
||||||
- main
|
permissions:
|
||||||
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
|
outputs:
|
||||||
|
commit: ${{ steps.metadata.outputs.commit }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
architecture: [ amd64, arm64v8 ]
|
||||||
|
include:
|
||||||
|
- architecture: amd64
|
||||||
|
platform: linux/amd64
|
||||||
|
- architecture: arm64v8
|
||||||
|
platform: linux/arm64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout code
|
||||||
- uses: docker/login-action@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Obtain project metadata
|
||||||
|
id: metadata
|
||||||
|
run: echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Setup QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- run: docker buildx build . -t ghcr.io/rramiachraf/dumb:latest
|
|
||||||
- run: docker push ghcr.io/rramiachraf/dumb:latest
|
- name: Generate image metadata
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
id: image-metadata
|
||||||
|
with:
|
||||||
|
images: ghcr.io/${{ github.repository }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ matrix.architecture }}-${{ steps.metadata.outputs.commit }},enable={{is_default_branch}}
|
||||||
|
type=raw,value=${{ matrix.architecture }},enable={{is_default_branch}}
|
||||||
|
|
||||||
|
- name: Build and push platform specific images
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
platforms: ${{ matrix.platform }}
|
||||||
|
tags: ${{ steps.image-metadata.outputs.tags }}
|
||||||
|
|
||||||
|
merge:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
needs: [ build ]
|
||||||
|
env:
|
||||||
|
IMAGE: ghcr.io/${{ github.repository }}
|
||||||
|
COMMIT: ${{ needs.build.outputs.commit }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Generate manifest for multi-arch images from source manifests
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools create \
|
||||||
|
--tag ${IMAGE}:${COMMIT} ${IMAGE}:{amd64,arm64v8}-${COMMIT}
|
||||||
|
docker buildx imagetools create \
|
||||||
|
--tag ${IMAGE}:latest ${IMAGE}:{amd64,arm64v8}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user