-
Notifications
You must be signed in to change notification settings - Fork 6
102 lines (95 loc) · 2.92 KB
/
container-build-child-workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Reusable container build workflow
env:
# BUILDX_NO_DEFAULT_ATTESTATIONS must be set to build only arm64 and amd64 images.
# The devcontainers/[email protected] build will fail if this env variable is not set.
BUILDX_NO_DEFAULT_ATTESTATIONS: 1
on:
workflow_call:
inputs:
container_name:
required: true
type: string
image_tags:
required: false
type: string
default: latest
platform:
required: false
type: string
# there is no need to build ARM images for now
# disabling to save time and resources
default: linux/arm64/v8,linux/amd64
from_image:
required: true
type: string
from_variant:
required: true
type: string
username:
required: false
type: string
default: vscode
user_id:
required: false
type: string
default: 1000
group_id:
required: false
type: string
default: 1000
clab_version:
required: false
type: string
avd_github_repo:
required: false
type: string
avd_branch_name:
required: false
type: string
git_init:
required: false
type: boolean
default: true
ceos_lab_version:
required: false
type: string
default: latest
jobs:
build_image:
runs-on: ubuntu-22.04
steps:
- name: Starting container build
run: echo "Starting container build. Be patient. 🐢"
- name: Checkout code ✅
uses: actions/checkout@v4
- name: Setup QEMU for multi-arch builds 🏗️
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ inputs.platform }}
- name: Setup Docker buildX for multi-arch builds 🏗️
uses: docker/setup-buildx-action@v3
- name: Login to the container registry 🗝️
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pre-build dev container image 🔨
uses: devcontainers/[email protected]
env:
FROM_IMAGE: ${{ inputs.from_image }}
FROM_VARIANT: ${{ inputs.from_variant }}
USERNAME: ${{ inputs.username }}
UID: ${{ inputs.user_id }}
GID: ${{ inputs.group_id }}
CLAB_VERSION: ${{ inputs.clab_version }}
AVD_GITHUB_REPO: ${{ inputs.avd_github_repo }}
AVD_BRANCH_NAME: ${{ inputs.avd_branch_name }}
CEOS_LAB_VERSION_ARG: ${{ inputs.ceos_lab_version }}
GIT_INIT_ARG: ${{ inputs.git_init }}
with:
subFolder: containers/${{ inputs.container_name }}-${{ inputs.image_tags }}
imageName: ghcr.io/${{ github.repository }}/${{ inputs.container_name }}
imageTag: ${{ inputs.image_tags }}
platform: ${{ inputs.platform }}
push: always