mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
Separate platform builds & combine to single manifest
This commit is contained in:
parent
5108b3db95
commit
5e6c96bdd1
2 changed files with 89 additions and 18 deletions
72
.github/workflows/release.yaml
vendored
72
.github/workflows/release.yaml
vendored
|
|
@ -40,10 +40,62 @@ jobs:
|
|||
- name: Publish release distributions to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
|
||||
deploy-container-image:
|
||||
build-platform-image:
|
||||
|
||||
name: Release container images
|
||||
name: Build ${{ matrix.container }} (${{ matrix.platform }})
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
environment:
|
||||
name: release
|
||||
strategy:
|
||||
matrix:
|
||||
container:
|
||||
- base
|
||||
- flow
|
||||
- bedrock
|
||||
- vertexai
|
||||
- hf
|
||||
- ocr
|
||||
- unstructured
|
||||
- mcp
|
||||
platform:
|
||||
- amd64
|
||||
- arm64
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU - for ARM emulation
|
||||
if: matrix.platform == 'arm64'
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: arm64
|
||||
|
||||
- name: Docker Hub token
|
||||
run: echo ${{ secrets.DOCKER_SECRET }} > docker-token.txt
|
||||
|
||||
- name: Authenticate with Docker hub
|
||||
run: make docker-hub-login
|
||||
|
||||
- name: Get version
|
||||
id: version
|
||||
run: echo VERSION=$(git describe --exact-match --tags | sed 's/^v//') >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build container
|
||||
run: make platform-${{ matrix.container }}-${{ matrix.platform }} VERSION=${{ steps.version.outputs.VERSION }}
|
||||
|
||||
- name: Push container
|
||||
run: make push-platform-${{ matrix.container }}-${{ matrix.platform }} VERSION=${{ steps.version.outputs.VERSION }}
|
||||
|
||||
combine-manifests:
|
||||
|
||||
name: Combine manifest ${{ matrix.container }}
|
||||
runs-on: ubuntu-24.04
|
||||
needs: build-platform-image
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
|
|
@ -66,11 +118,6 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU - for ARM emulation
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: arm64
|
||||
|
||||
- name: Docker Hub token
|
||||
run: echo ${{ secrets.DOCKER_SECRET }} > docker-token.txt
|
||||
|
||||
|
|
@ -81,12 +128,5 @@ jobs:
|
|||
id: version
|
||||
run: echo VERSION=$(git describe --exact-match --tags | sed 's/^v//') >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Put version into package manifests
|
||||
run: make update-package-versions VERSION=${{ steps.version.outputs.VERSION }}
|
||||
|
||||
- name: Build container - ${{ matrix.container }}
|
||||
run: make manifest-${{ matrix.container }} VERSION=${{ steps.version.outputs.VERSION }}
|
||||
|
||||
- name: Push container - ${{ matrix.container }}
|
||||
run: make push-manifest-${{ matrix.container }} VERSION=${{ steps.version.outputs.VERSION }}
|
||||
|
||||
- name: Combine and push manifest
|
||||
run: make combine-manifest-${{ matrix.container }} VERSION=${{ steps.version.outputs.VERSION }}
|
||||
|
|
|
|||
35
Makefile
35
Makefile
|
|
@ -75,7 +75,7 @@ container-%: update-package-versions
|
|||
-f containers/Containerfile.${@:container-%=%} \
|
||||
-t ${CONTAINER_BASE}/trustgraph-${@:container-%=%}:${VERSION} .
|
||||
|
||||
# Individual container build targets
|
||||
# Multi-arch: build both platforms sequentially into one manifest (local use)
|
||||
manifest-%: update-package-versions
|
||||
-@${DOCKER} manifest rm \
|
||||
${CONTAINER_BASE}/trustgraph-${@:manifest-%=%}:${VERSION}
|
||||
|
|
@ -84,12 +84,43 @@ manifest-%: update-package-versions
|
|||
--manifest \
|
||||
${CONTAINER_BASE}/trustgraph-${@:manifest-%=%}:${VERSION} .
|
||||
|
||||
# Multi-arch: build a single platform image (for parallel CI)
|
||||
platform-%-amd64: update-package-versions
|
||||
${DOCKER} build --platform linux/amd64 \
|
||||
-f containers/Containerfile.${@:platform-%-amd64=%} \
|
||||
-t ${CONTAINER_BASE}/trustgraph-${@:platform-%-amd64=%}:${VERSION}-amd64 .
|
||||
|
||||
platform-%-arm64: update-package-versions
|
||||
${DOCKER} build --platform linux/arm64 \
|
||||
-f containers/Containerfile.${@:platform-%-arm64=%} \
|
||||
-t ${CONTAINER_BASE}/trustgraph-${@:platform-%-arm64=%}:${VERSION}-arm64 .
|
||||
|
||||
# Push a single platform image
|
||||
push-platform-%-amd64:
|
||||
${DOCKER} push \
|
||||
${CONTAINER_BASE}/trustgraph-${@:push-platform-%-amd64=%}:${VERSION}-amd64
|
||||
|
||||
push-platform-%-arm64:
|
||||
${DOCKER} push \
|
||||
${CONTAINER_BASE}/trustgraph-${@:push-platform-%-arm64=%}:${VERSION}-arm64
|
||||
|
||||
# Combine per-platform images into a multi-arch manifest
|
||||
combine-manifest-%:
|
||||
-@${DOCKER} manifest rm \
|
||||
${CONTAINER_BASE}/trustgraph-${@:combine-manifest-%=%}:${VERSION}
|
||||
${DOCKER} manifest create \
|
||||
${CONTAINER_BASE}/trustgraph-${@:combine-manifest-%=%}:${VERSION} \
|
||||
docker://${CONTAINER_BASE}/trustgraph-${@:combine-manifest-%=%}:${VERSION}-amd64 \
|
||||
docker://${CONTAINER_BASE}/trustgraph-${@:combine-manifest-%=%}:${VERSION}-arm64
|
||||
${DOCKER} manifest push \
|
||||
${CONTAINER_BASE}/trustgraph-${@:combine-manifest-%=%}:${VERSION}
|
||||
|
||||
# Push a container
|
||||
push-container-%:
|
||||
${DOCKER} push \
|
||||
${CONTAINER_BASE}/trustgraph-${@:push-container-%=%}:${VERSION}
|
||||
|
||||
# Push a manifest
|
||||
# Push a manifest (from local multi-arch build)
|
||||
push-manifest-%:
|
||||
${DOCKER} manifest push \
|
||||
${CONTAINER_BASE}/trustgraph-${@:push-manifest-%=%}:${VERSION}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue