Skip to content

Commit 3c7b611

Browse files
committed
Add docker build and helm chart
Signed-off-by: Alan Sherman <asherman@linuxfoundation.org>
1 parent 90e782c commit 3c7b611

File tree

12 files changed

+877
-0
lines changed

12 files changed

+877
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copyright The Linux Foundation and each contributor to LFX.
2+
# SPDX-License-Identifier: MIT
3+
4+
name: Docker Build - Main Branch
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
types: [opened, ready_for_review, reopened]
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
env:
18+
REGISTRY: ghcr.io
19+
IMAGE_NAME: ${{ github.repository }}
20+
21+
jobs:
22+
build-and-push:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
id-token: write
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v3
35+
36+
- name: Log in to Container Registry
37+
uses: docker/login-action@v3
38+
with:
39+
registry: ${{ env.REGISTRY }}
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Extract metadata
44+
id: meta
45+
uses: docker/metadata-action@v5
46+
with:
47+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
tags: |
49+
type=raw,value=development
50+
51+
- name: Build and push Docker image
52+
uses: docker/build-push-action@v5
53+
with:
54+
context: .
55+
push: true
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}
58+
platforms: linux/amd64,linux/arm64
59+
cache-from: type=gha
60+
cache-to: type=gha,mode=max
61+
build-args: |
62+
BUILD_ENV=production
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Copyright The Linux Foundation and each contributor to LFX.
2+
# SPDX-License-Identifier: MIT
3+
4+
name: Docker Build - Release
5+
6+
on:
7+
push:
8+
tags:
9+
- v*
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
REGISTRY: ghcr.io
16+
IMAGE_NAME: ${{ github.repository }}
17+
COSIGN_VERSION: v2.5.3
18+
HELM_VERSION: v3.18.4
19+
20+
jobs:
21+
build-and-push:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
packages: write
26+
id-token: write
27+
outputs:
28+
app_version: ${{ steps.prepare.outputs.app_version }}
29+
chart_name: ${{ steps.prepare.outputs.chart_name }}
30+
chart_version: ${{ steps.prepare.outputs.chart_version }}
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
36+
- name: Prepare versions and chart name
37+
id: prepare
38+
run: |
39+
set -euo pipefail
40+
APP_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g')
41+
CHART_NAME="$(yq '.name' charts/*/Chart.yaml)"
42+
CHART_VERSION="$(yq '.version' charts/*/Chart.yaml)"
43+
{
44+
echo "app_version=$APP_VERSION"
45+
echo "chart_name=$CHART_NAME"
46+
echo "chart_version=$CHART_VERSION"
47+
} >> "$GITHUB_OUTPUT"
48+
49+
- name: Set up Docker Buildx
50+
uses: docker/setup-buildx-action@v3
51+
52+
- name: Log in to Container Registry
53+
uses: docker/login-action@v3
54+
with:
55+
registry: ${{ env.REGISTRY }}
56+
username: ${{ github.actor }}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Extract metadata
60+
id: meta
61+
uses: docker/metadata-action@v5
62+
with:
63+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
64+
tags: |
65+
type=semver,pattern={{version}}
66+
type=semver,pattern={{major}}.{{minor}}
67+
68+
- name: Build and push Docker image
69+
uses: docker/build-push-action@v5
70+
with:
71+
context: .
72+
push: true
73+
tags: ${{ steps.meta.outputs.tags }}
74+
labels: ${{ steps.meta.outputs.labels }}
75+
platforms: linux/amd64,linux/arm64
76+
cache-from: type=gha
77+
cache-to: type=gha,mode=max
78+
build-args: |
79+
BUILD_ENV=production
80+
81+
release-helm-chart:
82+
needs: build-and-push
83+
runs-on: ubuntu-latest
84+
permissions:
85+
contents: write
86+
packages: write
87+
id-token: write
88+
outputs:
89+
digest: ${{ steps.publish-ghcr.outputs.digest }}
90+
image_name: ${{ steps.publish-ghcr.outputs.image_name }}
91+
steps:
92+
- name: Checkout repository
93+
uses: actions/checkout@v4
94+
95+
- name: Publish Chart to GHCR
96+
id: publish-ghcr
97+
uses: linuxfoundation/lfx-public-workflows/.github/actions/helm-chart-oci-publisher@c465d6571fa0b8be9d551d902955164ea04a00af # main
98+
with:
99+
name: ${{ needs.build-and-push.outputs.chart_name }}
100+
repository: ${{ github.repository }}/chart
101+
chart_version: ${{ needs.build-and-push.outputs.chart_version }}
102+
app_version: ${{ needs.build-and-push.outputs.app_version }}
103+
registry: ghcr.io
104+
registry_username: ${{ github.actor }}
105+
registry_password: ${{ secrets.GITHUB_TOKEN }}
106+
107+
- name: Install Cosign
108+
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
109+
with:
110+
cosign-release: "${{ env.COSIGN_VERSION }}"
111+
112+
- name: Login to GitHub
113+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
114+
with:
115+
registry: ghcr.io
116+
username: ${{ github.actor }}
117+
password: ${{ secrets.GITHUB_TOKEN }}
118+
119+
- name: Sign the Helm chart in GHCR
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
run: |
123+
set -euo pipefail
124+
cosign sign --yes '${{ steps.publish-ghcr.outputs.image_name }}@${{ steps.publish-ghcr.outputs.digest }}'
125+
126+
create-ghcr-helm-provenance:
127+
needs:
128+
- release-helm-chart
129+
permissions:
130+
actions: read
131+
id-token: write
132+
packages: write
133+
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
134+
with:
135+
image: ${{ needs.release-helm-chart.outputs.image_name }}
136+
digest: ${{ needs.release-helm-chart.outputs.digest }}
137+
registry-username: ${{ github.actor }}
138+
secrets:
139+
registry-password: ${{ secrets.GITHUB_TOKEN }}

charts/lfx-v2-pcc-ui/Chart.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright The Linux Foundation and each contributor to LFX.
2+
# SPDX-License-Identifier: MIT
3+
4+
apiVersion: v2
5+
name: lfx-v2-pcc-ui
6+
description: A Helm chart for LFX Project Control Center UI - Angular SSR application with Express backend
7+
type: application
8+
version: 0.1.0
9+
appVersion: "latest"
10+
keywords:
11+
- lfx
12+
- project-control-center
13+
- ui
14+
- angular
15+
- ssr
16+
- express
17+
home: https://github.com/linuxfoundation/lfx-v2-pcc-ui
18+
sources:
19+
- https://github.com/linuxfoundation/lfx-v2-pcc-ui
20+
maintainers:
21+
- name: Linux Foundation
22+
email: lfx-support@linuxfoundation.org
23+
annotations:
24+
artifacthub.io/license: MIT
25+
artifacthub.io/operator: "false"
26+
artifacthub.io/signKey: |
27+
fingerprint: C874011F0AB405110D02105534365D9472D7468F
28+
url: https://keybase.io/linuxfoundation/pgp_keys.asc

0 commit comments

Comments
 (0)