Skip to content

Commit 61d0bf0

Browse files
committed
wip
1 parent 2b64c56 commit 61d0bf0

8 files changed

Lines changed: 372 additions & 308 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Build and publish the agent Docker image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- ".github/workflows/build-agent-docker-image.yml"
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository_owner }}/blink-agent
12+
13+
jobs:
14+
build:
15+
strategy:
16+
matrix:
17+
include:
18+
- runner: ubuntu-latest
19+
platform: linux/amd64
20+
- runner: ubuntu-24.04-arm
21+
platform: linux/arm64
22+
runs-on: ${{ matrix.runner }}
23+
permissions:
24+
contents: read
25+
packages: write
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v5
29+
30+
- name: Log in to the Container registry
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Build and push by digest
38+
id: build
39+
uses: docker/build-push-action@v6
40+
with:
41+
context: packages/server/docker
42+
file: packages/server/docker/Dockerfile
43+
platforms: ${{ matrix.platform }}
44+
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
45+
46+
- name: Upload digest
47+
run: |
48+
mkdir -p /tmp/digests
49+
platform="${{ matrix.platform }}"
50+
echo "${{ steps.build.outputs.digest }}" > "/tmp/digests/${platform//\//-}"
51+
- uses: actions/upload-artifact@v4
52+
with:
53+
name: digest-${{ matrix.runner }}
54+
path: /tmp/digests/*
55+
retention-days: 1
56+
57+
create-manifest:
58+
needs: build
59+
runs-on: ubuntu-latest
60+
permissions:
61+
contents: read
62+
packages: write
63+
steps:
64+
- name: Download digests
65+
uses: actions/download-artifact@v4
66+
with:
67+
path: /tmp/digests
68+
pattern: digest-*
69+
merge-multiple: true
70+
71+
- name: Log in to the Container registry
72+
uses: docker/login-action@v3
73+
with:
74+
registry: ${{ env.REGISTRY }}
75+
username: ${{ github.actor }}
76+
password: ${{ secrets.GITHUB_TOKEN }}
77+
78+
- name: Create and push manifest
79+
run: |
80+
SHORT_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$(echo ${{ github.sha }} | cut -c1-7)"
81+
82+
docker manifest create $SHORT_TAG \
83+
$(for digest in /tmp/digests/*; do echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@$(cat $digest)"; done)
84+
docker manifest push $SHORT_TAG

0 commit comments

Comments
 (0)