Skip to content

Commit b3d3dbb

Browse files
committed
add build-devcontainer.yaml workflow
1 parent 9b3ec6b commit b3d3dbb

1 file changed

Lines changed: 135 additions & 0 deletions

File tree

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
push:
5+
type: string
6+
default: true
7+
description: "Whether to push the image."
8+
repo:
9+
type: string
10+
required: true
11+
description: "Devcontainer image repository."
12+
tag:
13+
type: string
14+
required: true
15+
description: "Devcontainer image tag."
16+
workspace-dir:
17+
type: string
18+
default: '.'
19+
description: "Devcontainer workspace directory."
20+
devcontainer-json:
21+
type: string
22+
required: true
23+
description: "Path to the devcontainer.json file."
24+
timeout-minutes:
25+
type: number
26+
default: 360
27+
description: "Maximum time (in minutes) allowed for a run of this workflow."
28+
retries:
29+
type: string
30+
default: '10'
31+
description: "Number of times to retry the image build"
32+
registry:
33+
default: ""
34+
required: false
35+
description: "URL of container registry to login to. Only required if push=true."
36+
username:
37+
default: ""
38+
required: false
39+
description: "Username used to log in to the container registry. Only required if push=true."
40+
password:
41+
default: ""
42+
required: false
43+
description: "Password used to log in to the container registry. Only required if push=true."
44+
runs-on:
45+
type: string
46+
default: "ubuntu-latest"
47+
description: "GHA runner label."
48+
49+
permissions:
50+
actions: read
51+
checks: none
52+
contents: read
53+
deployments: none
54+
discussions: none
55+
id-token: write
56+
issues: none
57+
packages: write
58+
pages: none
59+
pull-requests: read
60+
repository-projects: none
61+
security-events: none
62+
statuses: none
63+
64+
jobs:
65+
build:
66+
timeout-minutes: ${{ inputs.timeout-minutes }}
67+
strategy:
68+
fail-fast: false
69+
matrix:
70+
arch: [amd64, arm64]
71+
runs-on: ${{ inputs.runs-on }}
72+
name: "Build ${{ inputs.repo }}:${{ inputs.tag }} (${{ matrix.arch }})"
73+
outputs:
74+
hash_amd64: ${{ steps.build.outputs.hash_amd64 }}
75+
hash_arm64: ${{ steps.build.outputs.hash_arm64 }}
76+
steps:
77+
- uses: actions/checkout@v6
78+
with:
79+
fetch-depth: 0
80+
persist-credentials: false
81+
82+
- name: Setup proxy cache
83+
uses: nv-gha-runners/setup-proxy-cache@main
84+
continue-on-error: true
85+
with:
86+
enable-apt: true
87+
88+
- name: Login to ${{ inputs.registry }}
89+
if: inputs.push == 'true'
90+
uses: docker/login-action@v4
91+
with:
92+
registry: "${{ inputs.registry }}"
93+
username: "${{ inputs.username }}"
94+
password: "${{ inputs.password }}"
95+
96+
- id: build
97+
name: Build devcontainer (${{ matrix.arch }})
98+
uses: rapidsai/shared-actions/build-devcontainer@fea/build-devcontainer
99+
with:
100+
arch: "${{ matrix.arch }}"
101+
repo: "${{ inputs.repo }}"
102+
push: "${{ inputs.push }}"
103+
retries: "${{ inputs.retries }}"
104+
tag: "${{ inputs.tag }}"
105+
workspace-dir: "${{ inputs.workspace-dir }}"
106+
devcontainer-json: "${{ inputs.devcontainer-json }}"
107+
108+
push:
109+
if: inputs.push == 'true'
110+
name: Push to ${{ inputs.registry }}
111+
needs: [build]
112+
runs-on: ubuntu-latest
113+
steps:
114+
- name: Login to ${{ inputs.registry }}
115+
uses: docker/login-action@v4
116+
with:
117+
registry: "${{ inputs.registry }}"
118+
username: "${{ inputs.username }}"
119+
password: "${{ inputs.password }}"
120+
121+
- name: Push manifest to ${{ inputs.registry }}
122+
shell: bash --noprofile --norc -x -eo pipefail {0}
123+
env:
124+
hash_amd64: "${{ needs.build.outputs.hash_amd64 }}"
125+
hash_arm64: "${{ needs.build.outputs.hash_arm64 }}"
126+
repo: "${{ inputs.repo }}"
127+
tag: "${{ inputs.tag }}"
128+
run: |
129+
# Ensure repo is lowercase
130+
repo="${repo,,}";
131+
name="${repo}:${tag}";
132+
docker manifest rm "${name}" || true;
133+
sleep 5;
134+
# Create and push the multiarch manifest
135+
docker buildx imagetools create --tag "${name}" "${hash_amd64}" "${hash_arm64}";

0 commit comments

Comments
 (0)