-
Notifications
You must be signed in to change notification settings - Fork 9
76 lines (63 loc) · 2.16 KB
/
docker-release-ui.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
name: Build and Push Docker Images on Release
on:
release:
types: [published]
jobs:
build-and-push-release:
runs-on: ubuntu-latest
env:
IMAGE_NAME: eclipsebasyx/aas-gui
SBOM_FILE: sbom.json
steps:
# Step 1: Checkout the repository
- name: Checkout Code
uses: actions/checkout@v4
# Step 2: Set up Docker Buildx
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Step 3: Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
# Step 4: Extract Release Tag as Date
- name: Extract Release Tag
id: extract_tag
run: |
# Assuming the release tag is in yymmdd format
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
# Step 5: Build and Push Docker Images
- name: Build and Push Docker Images
uses: docker/build-push-action@v6
with:
context: ./aas-web-ui
file: ./aas-web-ui/Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: |
${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}
${{ env.IMAGE_NAME }}:latest
# Step 6: Generate SBOM with Syft
- name: Install Syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
- name: Generate SBOM
run: |
syft ${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }} -o json > ${{ env.SBOM_FILE }}
# Step 7: Upload SBOM as an Artifact
- name: Upload SBOM
uses: actions/upload-artifact@v3
with:
name: sbom
path: ${{ env.SBOM_FILE }}
# Step 8: Verify the Push
- name: Verify Docker Images
run: |
docker pull ${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}
docker pull ${{ env.IMAGE_NAME }}:latest