71 lines
2.2 KiB
YAML
71 lines
2.2 KiB
YAML
name: Build and Publish Docker Image (Semantic Cache)
|
|
|
|
# Builds the :semantic variant that includes sentence-transformers + CPU torch
|
|
# and the pre-baked all-MiniLM-L6-v2 embedding model (~500 MB larger than lean).
|
|
# Tags mirror the lean workflow but carry a -semantic suffix, e.g.:
|
|
# ghcr.io/nomyo-ai/nomyo-router:latest-semantic
|
|
# ghcr.io/nomyo-ai/nomyo-router:0.7.0-semantic
|
|
# ghcr.io/nomyo-ai/nomyo-router:0.7-semantic
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*.*.*"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
build-and-push-semantic:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU (for multi-arch builds)
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
# Versioned semantic tags on git tags (e.g. v0.7.0 → 0.7.0-semantic, 0.7-semantic)
|
|
type=semver,pattern={{version}}-semantic
|
|
type=semver,pattern={{major}}.{{minor}}-semantic
|
|
# latest-semantic only on main branch pushes
|
|
type=raw,value=latest-semantic,enable=${{ github.ref == 'refs/heads/main' }}
|
|
# SHA-tagged for traceability
|
|
type=sha,prefix=sha-,suffix=-semantic
|
|
|
|
- name: Build and push semantic Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
build-args: |
|
|
SEMANTIC_CACHE=true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|