Use docker buildx and multiplatform

This commit is contained in:
Apher 2026-07-16 02:44:20 +00:00
parent c744fff196
commit ec74a78bb7

View File

@ -12,30 +12,28 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Login to Registry - name: Login to Registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: gitea.spilum.net registry: gitea.spilum.net
username: ${{ secrets.REGISTRY_USER }} username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }} password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build Docker Image - name: Set up Docker Buildx
env: uses: docker/setup-buildx-action@v3
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.spilum.net/spilum.net/mtf-nlp:${BRANCH_NAME}-${SHORT_HASH:0:5} .
# Tag the same image as "latest" - name: Build and Push (multi-arch)
docker tag gitea.spilum.net/spilum.net/mtf-nlp:${BRANCH_NAME}-${SHORT_HASH:0:5} gitea.spilum.net/spilum.net/mtf-nlp:${BRANCH_NAME}-latest uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
- name: Push Docker Image build-args: |
env: BUILD_IDENTIFIER=${{ github.sha[0:5] }}
BRANCH_NAME: ${{ github.ref_name }}
SHORT_HASH: ${{ github.sha }} tags: |
run: | gitea.spilum.net/spilum.net/mtf-nlp:${{ github.ref_name }}-${{ github.sha[0:5] }}
docker push gitea.spilum.net/spilum.net/mtf-nlp:${BRANCH_NAME}-${SHORT_HASH:0:5} gitea.spilum.net/spilum.net/mtf-nlp:${{ github.ref_name }}-latest
docker push gitea.spilum.net/spilum.net/mtf-nlp:${BRANCH_NAME}-latest
- name: Log out from registry - name: Log out from registry
if: always() if: always()