Skip to content

Commit db50dc4

Browse files
committed
wip
1 parent 2b64c56 commit db50dc4

8 files changed

Lines changed: 375 additions & 308 deletions

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Log in to the Container registry
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Build and push by digest
41+
id: build
42+
uses: docker/build-push-action@v6
43+
with:
44+
context: packages/server/docker
45+
file: packages/server/docker/Dockerfile
46+
platforms: ${{ matrix.platform }}
47+
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
48+
49+
- name: Upload digest
50+
run: |
51+
mkdir -p /tmp/digests
52+
platform="${{ matrix.platform }}"
53+
echo "${{ steps.build.outputs.digest }}" > "/tmp/digests/${platform//\//-}"
54+
- uses: actions/upload-artifact@v4
55+
with:
56+
name: digest-${{ matrix.runner }}
57+
path: /tmp/digests/*
58+
retention-days: 1
59+
60+
create-manifest:
61+
needs: build
62+
runs-on: ubuntu-latest
63+
permissions:
64+
contents: read
65+
packages: write
66+
steps:
67+
- name: Download digests
68+
uses: actions/download-artifact@v4
69+
with:
70+
path: /tmp/digests
71+
pattern: digest-*
72+
merge-multiple: true
73+
74+
- name: Log in to the Container registry
75+
uses: docker/login-action@v3
76+
with:
77+
registry: ${{ env.REGISTRY }}
78+
username: ${{ github.actor }}
79+
password: ${{ secrets.GITHUB_TOKEN }}
80+
81+
- name: Create and push manifest
82+
run: |
83+
SHORT_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$(echo ${{ github.sha }} | cut -c1-7)"
84+
85+
docker manifest create $SHORT_TAG \
86+
$(for digest in /tmp/digests/*; do echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@$(cat $digest)"; done)
87+
docker manifest push $SHORT_TAG

0 commit comments

Comments
 (0)