Skip to content

ci: Add Docker-based tests with pgvector and Ollama services #1

ci: Add Docker-based tests with pgvector and Ollama services

ci: Add Docker-based tests with pgvector and Ollama services #1

# ============================================================================
# Build Ollama Flow Judge Image
# ============================================================================
#
# Builds and pushes the Ollama image with pre-loaded flow-judge model to ghcr.io.
# This image is used by the integration tests workflow.
#
# TRIGGERS:
# - Push to main with changes to the Dockerfile
# - Manual trigger (workflow_dispatch)
#
# The image is cached in ghcr.io and only rebuilt when:
# - The Dockerfile changes
# - Manually triggered (e.g., to update to newer Ollama version)
#
# ============================================================================
name: Build Ollama Image
on:
push:
branches: [main]
paths:
- '.github/docker/ollama-flow-judge/**'
workflow_dispatch:
inputs:
force_rebuild:
description: 'Force rebuild even if no changes'
required: false
default: false
type: boolean
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/ollama-flow-judge
jobs:
build-and-push:
name: Build and Push Ollama Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=sha,prefix=
type=raw,value={{date 'YYYYMMDD'}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .github/docker/ollama-flow-judge
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Summary
run: |
echo "## Ollama Image Built" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Image:** \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Tags:**" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Contains:**" >> $GITHUB_STEP_SUMMARY
echo "- Ollama server" >> $GITHUB_STEP_SUMMARY
echo "- \`avcodes/flowaicom-flow-judge:q4\` model pre-loaded" >> $GITHUB_STEP_SUMMARY