Skip to content

Commit 63a5cf3

Browse files
authored
Merge pull request NVIDIA#3 from maxamillion/container-builds
feat(ci): add container build pipeline for midstream
2 parents b52d683 + d748abb commit 63a5cf3

1 file changed

Lines changed: 123 additions & 0 deletions

File tree

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Midstream Container Build
5+
6+
on:
7+
push:
8+
branches: [midstream]
9+
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
env:
15+
REGISTRY: ghcr.io
16+
IMAGE_REGISTRY: ghcr.io/lobstertrap/openshell
17+
18+
jobs:
19+
# ---------------------------------------------------------------------------
20+
# Build container images natively on per-arch runners
21+
# ---------------------------------------------------------------------------
22+
build:
23+
name: Build ${{ matrix.component }} (${{ matrix.arch }})
24+
runs-on: ${{ matrix.runner }}
25+
timeout-minutes: 60
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
include:
30+
- component: gateway
31+
arch: amd64
32+
runner: ubuntu-latest
33+
platform: linux/amd64
34+
- component: gateway
35+
arch: arm64
36+
runner: ubuntu-latest-arm64
37+
platform: linux/arm64
38+
- component: cluster
39+
arch: amd64
40+
runner: ubuntu-latest
41+
platform: linux/amd64
42+
- component: cluster
43+
arch: arm64
44+
runner: ubuntu-latest-arm64
45+
platform: linux/arm64
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0
51+
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v3
54+
55+
- name: Log in to GitHub Container Registry
56+
uses: docker/login-action@v3
57+
with:
58+
registry: ${{ env.REGISTRY }}
59+
username: ${{ github.actor }}
60+
password: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Build and push (${{ matrix.component }}/${{ matrix.arch }})
63+
uses: docker/build-push-action@v6
64+
with:
65+
context: .
66+
file: deploy/docker/Dockerfile.images
67+
target: ${{ matrix.component }}
68+
platforms: ${{ matrix.platform }}
69+
push: true
70+
tags: ${{ env.IMAGE_REGISTRY }}/${{ matrix.component }}:${{ github.sha }}-${{ matrix.arch }}
71+
cache-from: type=gha,scope=${{ matrix.component }}-${{ matrix.arch }}
72+
cache-to: type=gha,mode=max,scope=${{ matrix.component }}-${{ matrix.arch }}
73+
74+
# ---------------------------------------------------------------------------
75+
# Merge per-arch images into multi-arch manifests
76+
# ---------------------------------------------------------------------------
77+
merge-gateway:
78+
name: Merge gateway manifest
79+
runs-on: ubuntu-latest
80+
needs: [build]
81+
steps:
82+
- name: Log in to GitHub Container Registry
83+
uses: docker/login-action@v3
84+
with:
85+
registry: ${{ env.REGISTRY }}
86+
username: ${{ github.actor }}
87+
password: ${{ secrets.GITHUB_TOKEN }}
88+
89+
- name: Set up Docker Buildx
90+
uses: docker/setup-buildx-action@v3
91+
92+
- name: Create multi-arch manifest
93+
run: |
94+
set -euo pipefail
95+
docker buildx imagetools create \
96+
-t "${{ env.IMAGE_REGISTRY }}/gateway:${{ github.sha }}" \
97+
-t "${{ env.IMAGE_REGISTRY }}/gateway:midstream" \
98+
"${{ env.IMAGE_REGISTRY }}/gateway:${{ github.sha }}-amd64" \
99+
"${{ env.IMAGE_REGISTRY }}/gateway:${{ github.sha }}-arm64"
100+
101+
merge-cluster:
102+
name: Merge cluster manifest
103+
runs-on: ubuntu-latest
104+
needs: [build]
105+
steps:
106+
- name: Log in to GitHub Container Registry
107+
uses: docker/login-action@v3
108+
with:
109+
registry: ${{ env.REGISTRY }}
110+
username: ${{ github.actor }}
111+
password: ${{ secrets.GITHUB_TOKEN }}
112+
113+
- name: Set up Docker Buildx
114+
uses: docker/setup-buildx-action@v3
115+
116+
- name: Create multi-arch manifest
117+
run: |
118+
set -euo pipefail
119+
docker buildx imagetools create \
120+
-t "${{ env.IMAGE_REGISTRY }}/cluster:${{ github.sha }}" \
121+
-t "${{ env.IMAGE_REGISTRY }}/cluster:midstream" \
122+
"${{ env.IMAGE_REGISTRY }}/cluster:${{ github.sha }}-amd64" \
123+
"${{ env.IMAGE_REGISTRY }}/cluster:${{ github.sha }}-arm64"

0 commit comments

Comments
 (0)