feat: refactor docker workflow; build both amd64 and arm64 docker images
Some checks failed
Build and push Docker image / build (push) Failing after 54s

This commit is contained in:
2025-12-07 20:18:24 +01:00
parent 52dbd158a9
commit 2e325fe018

View File

@@ -1,4 +1,5 @@
# Credit: https://www.vanmeeuwen.dev/blog/automating-docker-builds-with-gitea-actions
# Credits: https://www.vanmeeuwen.dev/blog/automating-docker-builds-with-gitea-actions
# https://gitea.com/gitea/runner-images/src/branch/main/.gitea/workflows/release.yaml
name: Build and push Docker image
run-name: Building image on ${{ gitea.actor }}'s commit
@@ -15,6 +16,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Login to registry
uses: docker/login-action@v2
with:
@@ -22,24 +29,26 @@ jobs:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build Docker image
- name: Set outputs
id: vars
env:
BRANCH_NAME: ${{ github.ref_name }}
SHORT_HASH: ${{ github.sha }}
run: |
# Build the image with the commit hash tag
docker build --build-arg BUILD_IDENTIFIER=${SHORT_HASH:0:5} -t gitea.7o7.cx/kittyteam/kittybe:${BRANCH_NAME}-${SHORT_HASH:0:5} .
echo branch_name="$BRANCH_NAME" | tee -a $GITHUB_OUTPUT
echo short_hash=$(git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT
# Tag the same image as "latest"
docker tag gitea.7o7.cx/kittyteam/kittybe:${BRANCH_NAME}-${SHORT_HASH:0:5} gitea.7o7.cx/kittyteam/kittybe:${BRANCH_NAME}-latest
- name: Push Docker images
env:
BRANCH_NAME: ${{ github.ref_name }}
SHORT_HASH: ${{ github.sha }}
run: |
docker push gitea.7o7.cx/kittyteam/kittybe:${BRANCH_NAME}-${SHORT_HASH:0:5}
docker push gitea.7o7.cx/kittyteam/kittybe:${BRANCH_NAME}-latest
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: |
linux/amd64
linux/arm64
pull: true
push: true
tags: |
gitea.7o7.cx/kittyteam/kittybe:${{ steps.vars.outputs.branch_name }}-${{ steps.vars.outputs.short_hash }}
gitea.7o7.cx/kittyteam/kittybe:${{ steps.vars.outputs.branch_name }}-latest
- name: Log out from registry
if: always()