Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Docker Multi-Architecture Build #9

Docker Multi-Architecture Build

Docker Multi-Architecture Build #9

Workflow file for this run

name: Docker Multi-Architecture Build
on:
release:
types: [published]
workflow_dispatch:
inputs:
image:
description: 'Image to build (leave empty to build all)'
required: false
default: ''
type: choice
options:
- ''
- studio-api
- voice-server
- studio-web
env:
REGISTRY: ghcr.io
IMAGE_NAMESPACE: ${{ github.repository_owner }}
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: studio-api
context: .
dockerfile: studio/api/Dockerfile
image_name: feros-studio-api
- name: voice-server
context: .
dockerfile: voice/server/Dockerfile
image_name: feros-voice-server
- name: studio-web
context: .
dockerfile: studio/web/Dockerfile
image_name: feros-studio-web
steps:
- 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: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.image_name }}
tags: |
type=sha,format=short
type=ref,event=branch
type=ref,event=tag
type=edge,branch=main
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
if: ${{ !inputs.image || inputs.image == matrix.name }}
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
target: ${{ matrix.target || '' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=${{ matrix.image_name }}
cache-to: type=gha,mode=max,scope=${{ matrix.image_name }}