haiku.rag/.github/workflows/docker-publish-slim.yml
2025-11-17 14:18:41 +02:00

57 lines
1.6 KiB
YAML

name: Build & publish Docker slim image
on:
workflow_run:
workflows: ["Build & publish haiku.rag-slim to pypi"]
types:
- completed
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: read
packages: write
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v4
- 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: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from pyproject.toml
id: version
run: |
VERSION=$(grep -oP '^version = "\K[^"]+' haiku_rag_slim/pyproject.toml)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build and push Docker slim image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.slim
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/ggozad/haiku.rag-slim:${{ steps.version.outputs.version }}
ghcr.io/ggozad/haiku.rag-slim:latest
cache-from: type=gha
cache-to: type=gha,mode=max