Skip to content

Finalize distill parity migration and archive docs #4

Finalize distill parity migration and archive docs

Finalize distill parity migration and archive docs #4

name: Docker Backend
on:
workflow_dispatch:
pull_request:
paths:
- "backend/**"
- "deploy/**"
- ".github/workflows/docker-backend.yml"
push:
branches:
- main
tags:
- "v*"
paths:
- "backend/**"
- "deploy/**"
- ".github/workflows/docker-backend.yml"
permissions:
contents: read
packages: write
jobs:
detect-backend:
runs-on: ubuntu-latest
outputs:
backend_exists: ${{ steps.detect.outputs.backend_exists }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect backend crate
id: detect
run: |
if [ -f backend/Cargo.toml ]; then
echo "backend_exists=true" >> "$GITHUB_OUTPUT"
else
echo "backend_exists=false" >> "$GITHUB_OUTPUT"
fi
build-image:
needs: detect-backend
if: needs.detect-backend.outputs.backend_exists == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
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: Compute image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/memory-lancedb-pro-backend
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=tag
type=sha,format=short
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
- name: Log in to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and optionally push backend image
uses: docker/build-push-action@v6
with:
context: .
file: deploy/Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max