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