You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.6 KiB
46 lines
1.6 KiB
name: Build docker containers
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write
|
|
env:
|
|
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
|
|
VERSION: ${{ github.ref_name }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Login to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
# Build per-arch images
|
|
- name: Build amd64 image
|
|
run: |
|
|
docker build --platform linux/amd64 -t ${IMAGE_NAME}:${VERSION}-amd64 -f Dockerfile --build-arg ARCH=amd64 .
|
|
- name: Build arm64 image
|
|
run: |
|
|
docker build --platform linux/arm64 -t ${IMAGE_NAME}:${VERSION}-arm64 -f Dockerfile --build-arg ARCH=arm64 .
|
|
- name: Push per-arch images
|
|
run: |
|
|
docker push ${IMAGE_NAME}:${VERSION}-amd64
|
|
docker push ${IMAGE_NAME}:${VERSION}-arm64
|
|
# Create multi-arch manifest and push
|
|
- name: Push multi-arch manifest
|
|
run: |
|
|
docker manifest create ${IMAGE_NAME}:${VERSION} \
|
|
--amend ${IMAGE_NAME}:${VERSION}-amd64 \
|
|
--amend ${IMAGE_NAME}:${VERSION}-arm64
|
|
docker manifest push ${IMAGE_NAME}:${VERSION}
|
|
- name: Tag as latest
|
|
run: |
|
|
docker manifest create ${IMAGE_NAME}:latest \
|
|
--amend ${IMAGE_NAME}:${VERSION}-amd64 \
|
|
--amend ${IMAGE_NAME}:${VERSION}-arm64
|
|
docker manifest push ${IMAGE_NAME}:latest
|