Files
2026-03-09 22:30:41 +00:00

50 lines
1.3 KiB
YAML

name: Docker Build
on:
push:
branches: ["**"]
pull_request:
permissions:
contents: read
packages: write
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# Needed only for cross-platform builds (e.g. arm64 on amd64 runner)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build (PR) / Build+Push (push)
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name == 'push' }}
# Choose the platforms you actually want:
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository_owner }}/smtp-relay:ci
ghcr.io/${{ github.repository_owner }}/smtp-relay:${{ github.sha }}
# Optional: enable GH Actions cache for faster rebuilds
cache-from: type=gha
cache-to: type=gha,mode=max