name: Docker Image CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: miuda-ai/active-call
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Build Binaries
run: |
cross build --release --target x86_64-unknown-linux-gnu --no-default-features --features cross
cross build --release --target aarch64-unknown-linux-gnu --no-default-features --features cross
# Organize binaries for Docker Packaging
mkdir -p bin/amd64 bin/arm64
cp target/x86_64-unknown-linux-gnu/release/active-call bin/amd64/
cp target/aarch64-unknown-linux-gnu/release/active-call bin/arm64/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container registry
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && contains(github.event.head_commit.message, '[latest]')) }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
sbom: false