Make build cross-platform
This commit is contained in:
parent
5de34b68d8
commit
f1ac1c6af0
@ -1,4 +1,4 @@
|
||||
name: Build and Push Docker Image
|
||||
name: Build and Push Backend Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
@ -24,32 +24,30 @@ jobs:
|
||||
ls -la src/modules/redis
|
||||
|
||||
- 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: |
|
||||
docker build \
|
||||
--build-arg BUILD_IDENTIFIER=${SHORT_HASH:0:5} \
|
||||
-t gitea.spilum.net/spilum.net/mtf-backend:${BRANCH_NAME}-${SHORT_HASH:0:5} .
|
||||
- name: Set SHORT_SHA
|
||||
id: vars
|
||||
run: echo "short_sha=${GITHUB_SHA::5}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
docker tag \
|
||||
gitea.spilum.net/spilum.net/mtf-backend:${BRANCH_NAME}-${SHORT_HASH:0:5} \
|
||||
gitea.spilum.net/spilum.net/mtf-backend:${BRANCH_NAME}-latest
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Push Docker Image
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.ref_name }}
|
||||
SHORT_HASH: ${{ github.sha }}
|
||||
run: |
|
||||
docker push gitea.spilum.net/spilum.net/mtf-backend:${BRANCH_NAME}-${SHORT_HASH:0:5}
|
||||
docker push gitea.spilum.net/spilum.net/mtf-backend:${BRANCH_NAME}-latest
|
||||
- name: Build and Push Backend (multi-arch)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
BUILD_IDENTIFIER=${{ steps.vars.outputs.short_sha }}
|
||||
tags: |
|
||||
gitea.spilum.net/spilum.net/mtf-backend:${{ github.ref_name }}-${{ steps.vars.outputs.short_sha }}
|
||||
gitea.spilum.net/spilum.net/mtf-backend:${{ github.ref_name }}-latest
|
||||
|
||||
- name: Log out from registry
|
||||
if: always()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user