Skip to content

feat(jsonx): sonic-migration P0 foundation + P1 read-only scans #33

feat(jsonx): sonic-migration P0 foundation + P1 read-only scans

feat(jsonx): sonic-migration P0 foundation + P1 read-only scans #33

Workflow file for this run

name: docker-image
on:
push:
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Refresh models catalog
run: |
git fetch --depth 1 https://github.com/router-for-me/models.git main
git show FETCH_HEAD:models.json > internal/registry/models/models.json
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
type=sha,prefix=sha-
- name: Generate build metadata
run: |
{
echo "VERSION=${{ steps.meta.outputs.version }}"
echo "COMMIT=$(git rev-parse --short HEAD)"
echo "BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
} >> "$GITHUB_ENV"
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
# amd64-only: sonic JIT runs at full speed on amd64; arm64 dropped
# (sonic falls back to a slow compat path there). Simpler/faster builds.
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
build-args: |
VERSION=${{ env.VERSION }}
COMMIT=${{ env.COMMIT }}
BUILD_DATE=${{ env.BUILD_DATE }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max