lazydns 0.2.63

A light and fast DNS server/forwarder implementation in Rust
Documentation
name: Build and Push Docker Image

# NOTE: This workflow is intended to be run manually (via workflow_dispatch)
# or called by other workflows (via workflow_call). It no longer triggers
# automatically on push or tag events — use the `release.yml` workflow to
# invoke this workflow as part of the release pipeline.

on:
  workflow_dispatch:
  workflow_call:
    inputs:
      LAZYDNS_VERSION:
        required: false
        type: string
    secrets:
      DOCKERHUB_TOKEN:
        required: true
      DOCKERHUB_USERNAME:
        required: true

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        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 Docker Hub
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Log in to GitHub Container Registry
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Extract metadata
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: |
            lazywalker/lazydns
            ghcr.io/${{ github.repository_owner }}/lazydns
          tags: |
            type=ref,event=branch
            type=ref,event=pr
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}
            type=semver,pattern={{major}}
            type=sha
            type=raw,value=latest,enable={{is_default_branch}}

      - name: Build and push
        uses: docker/build-push-action@v5
        with:
          context: .
          file: ./docker/Dockerfile
          platforms: linux/amd64,linux/arm64,linux/arm/v7
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=gha
          cache-to: type=gha,mode=max
          build-args: |
            LAZYDNS_VERSION=${{ inputs.LAZYDNS_VERSION || (startsWith(github.ref, 'refs/tags/') && github.ref_name) || 'latest' }}