Skip to content

Build ZenML Postgres Image #4

Build ZenML Postgres Image

Build ZenML Postgres Image #4

name: Build ZenML Postgres Image
on:
workflow_dispatch:
inputs:
zenml_version:
description: "ZenML version to build"
required: true
type: string
env:
REGISTRY: ghcr.io
jobs:
build-and-push:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: infra/zenml
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/zenml-postgres
tags: |
type=raw,value=${{ inputs.zenml_version }}
type=raw,value=latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push ZenML Postgres image
id: build
uses: docker/build-push-action@v6
with:
context: infra/zenml
file: infra/zenml/Dockerfile.postgres
build-args: ZENML_VERSION=${{ inputs.zenml_version }}
platforms: linux/amd64
provenance: false
sbom: false
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=zenml-postgres,timeout=20m
cache-to: type=gha,mode=max,scope=zenml-postgres,timeout=20m,ignore-error=true
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Validate pushed manifest
env:
IMAGE_REF: ${{ env.REGISTRY }}/${{ github.repository_owner }}/zenml-postgres@${{ steps.build.outputs.digest }}
run: |
json=$(docker buildx imagetools inspect --format '{{json .}}' "$IMAGE_REF")
echo "$json" | jq -e '
if (.manifest.manifests? | type) == "array" then
(any(.manifest.manifests[]?; .platform.os == "linux" and .platform.architecture == "amd64"))
and
(all(.manifest.manifests[]?; (.platform.os != "unknown" and .platform.architecture != "unknown")))
else
(.image.os == "linux" and .image.architecture == "amd64")
end
' >/dev/null