Skip to content

Commit 021e288

Browse files
devin-ai-integration[bot]Convex, Inc.
authored andcommitted
feat: add workflows for self-hosted backend and dashboard Docker images (#34021)
Add workflows for building and pushing self-hosted Docker images. This PR adds two new workflow files: 1. `release_local_backend.yml.oss`: Builds and pushes the self-hosted backend Docker image - Uses `self-hosted/Dockerfile.backend` - Pushes to `ghcr.io/get-convex/self-hosted-backend` - Sets VERGEN build args for git SHA and commit timestamp 2. `release_local_dashboard.yml.oss`: Builds and pushes the self-hosted dashboard Docker image - Uses `self-hosted/Dockerfile.dashboard` - Pushes to `ghcr.io/get-convex/self-hosted-dashboard` Both workflows: - Use workflow_dispatch trigger with boolean input for latest tag - Build multi-architecture images (x64, arm64) - Create merged manifests for multi-arch support GitOrigin-RevId: 3e1f904507e9fc95aa9582ff3a4ef943ca410abc
1 parent c0f8191 commit 021e288

File tree

2 files changed

+206
-0
lines changed

2 files changed

+206
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Release Self-Hosted Backend
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag_latest:
7+
description: 'Tag image as latest'
8+
type: boolean
9+
default: false
10+
required: true
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
id-token: write
16+
17+
jobs:
18+
build:
19+
name: Build backend image
20+
strategy:
21+
matrix:
22+
arch: [x64, arm64]
23+
runs-on: [self-hosted, aws, "${{ matrix.arch }}", xlarge]
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Login to GitHub Container Registry
32+
uses: docker/login-action@v2
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Get UTC ISO8601 timestamp
39+
run: echo "COMMIT_TIMESTAMP=$(git log -1 --format='%aI' | date -f - --utc '+%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
40+
41+
- name: Build and push backend
42+
uses: docker/build-push-action@v6
43+
id: build-image
44+
env:
45+
DOCKER_BUILD_RECORD_UPLOAD: false
46+
with:
47+
context: .
48+
file: self-hosted/Dockerfile.backend
49+
tags: |
50+
ghcr.io/get-convex/self-hosted-backend
51+
cache-from: type=gha,mode=max
52+
cache-to: type=gha,mode=max
53+
outputs: push-by-digest=true,type=image,push=true
54+
provenance: false
55+
build-args: |
56+
VERGEN_GIT_SHA=${{ github.sha }}
57+
VERGEN_GIT_COMMIT_TIMESTAMP=${{ env.COMMIT_TIMESTAMP }}
58+
59+
- name: Write digest
60+
uses: cloudposse/github-action-matrix-outputs-write@v1
61+
id: digest
62+
with:
63+
matrix-step-name: ${{ github.job }}
64+
matrix-key: ${{ matrix.arch }}
65+
outputs: |-
66+
digest: ${{ steps.build-image.outputs.digest }}
67+
68+
read:
69+
runs-on: ubuntu-latest
70+
needs: [build]
71+
steps:
72+
- uses: cloudposse/github-action-matrix-outputs-read@v1
73+
id: read
74+
with:
75+
matrix-step-name: build
76+
outputs:
77+
result: "${{ steps.read.outputs.result }}"
78+
79+
push:
80+
name: Push merged image manifest
81+
needs: [read]
82+
runs-on: [self-hosted, aws, x64, medium]
83+
steps:
84+
- name: Login to GitHub Container Registry
85+
uses: docker/login-action@v2
86+
with:
87+
registry: ghcr.io
88+
username: ${{ github.actor }}
89+
password: ${{ secrets.GITHUB_TOKEN }}
90+
91+
- name: Set up Docker Buildx
92+
uses: docker/setup-buildx-action@v3
93+
94+
- name: Push manifest
95+
run: |
96+
docker manifest create ghcr.io/get-convex/self-hosted-backend:${{ github.sha }} \
97+
--amend ghcr.io/get-convex/self-hosted-backend@${{ fromJson(needs.read.outputs.result).digest.x64 }} \
98+
--amend ghcr.io/get-convex/self-hosted-backend@${{ fromJson(needs.read.outputs.result).digest.arm64 }}
99+
docker manifest push ghcr.io/get-convex/self-hosted-backend:${{ github.sha }}
100+
101+
if [[ "${{ github.event.inputs.tag_latest }}" == "true" ]]; then
102+
docker manifest create ghcr.io/get-convex/self-hosted-backend:latest \
103+
--amend ghcr.io/get-convex/self-hosted-backend@${{ fromJson(needs.read.outputs.result).digest.x64 }} \
104+
--amend ghcr.io/get-convex/self-hosted-backend@${{ fromJson(needs.read.outputs.result).digest.arm64 }}
105+
docker manifest push ghcr.io/get-convex/self-hosted-backend:latest
106+
fi
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Release Self-Hosted Dashboard
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag_latest:
7+
description: 'Tag image as latest'
8+
type: boolean
9+
default: false
10+
required: true
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
id-token: write
16+
17+
jobs:
18+
build:
19+
name: Build dashboard image
20+
strategy:
21+
matrix:
22+
arch: [x64, arm64]
23+
runs-on: [self-hosted, aws, "${{ matrix.arch }}", xlarge]
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Login to GitHub Container Registry
32+
uses: docker/login-action@v2
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Build and push dashboard
39+
uses: docker/build-push-action@v6
40+
id: build-image
41+
env:
42+
DOCKER_BUILD_RECORD_UPLOAD: false
43+
with:
44+
context: .
45+
file: self-hosted/Dockerfile.dashboard
46+
tags: |
47+
ghcr.io/get-convex/self-hosted-dashboard
48+
cache-from: type=gha,mode=max
49+
cache-to: type=gha,mode=max
50+
outputs: push-by-digest=true,type=image,push=true
51+
provenance: false
52+
53+
- name: Write digest
54+
uses: cloudposse/github-action-matrix-outputs-write@v1
55+
id: digest
56+
with:
57+
matrix-step-name: ${{ github.job }}
58+
matrix-key: ${{ matrix.arch }}
59+
outputs: |-
60+
digest: ${{ steps.build-image.outputs.digest }}
61+
62+
read:
63+
runs-on: ubuntu-latest
64+
needs: [build]
65+
steps:
66+
- uses: cloudposse/github-action-matrix-outputs-read@v1
67+
id: read
68+
with:
69+
matrix-step-name: build
70+
outputs:
71+
result: "${{ steps.read.outputs.result }}"
72+
73+
push:
74+
name: Push merged image manifest
75+
needs: [read]
76+
runs-on: [self-hosted, aws, x64, medium]
77+
steps:
78+
- name: Login to GitHub Container Registry
79+
uses: docker/login-action@v2
80+
with:
81+
registry: ghcr.io
82+
username: ${{ github.actor }}
83+
password: ${{ secrets.GITHUB_TOKEN }}
84+
85+
- name: Set up Docker Buildx
86+
uses: docker/setup-buildx-action@v3
87+
88+
- name: Push manifest
89+
run: |
90+
docker manifest create ghcr.io/get-convex/self-hosted-dashboard:${{ github.sha }} \
91+
--amend ghcr.io/get-convex/self-hosted-dashboard@${{ fromJson(needs.read.outputs.result).digest.x64 }} \
92+
--amend ghcr.io/get-convex/self-hosted-dashboard@${{ fromJson(needs.read.outputs.result).digest.arm64 }}
93+
docker manifest push ghcr.io/get-convex/self-hosted-dashboard:${{ github.sha }}
94+
95+
if [[ "${{ github.event.inputs.tag_latest }}" == "true" ]]; then
96+
docker manifest create ghcr.io/get-convex/self-hosted-dashboard:latest \
97+
--amend ghcr.io/get-convex/self-hosted-dashboard@${{ fromJson(needs.read.outputs.result).digest.x64 }} \
98+
--amend ghcr.io/get-convex/self-hosted-dashboard@${{ fromJson(needs.read.outputs.result).digest.arm64 }}
99+
docker manifest push ghcr.io/get-convex/self-hosted-dashboard:latest
100+
fi

0 commit comments

Comments
 (0)