Repository navigation
93 lines (83 loc) · 3.5 KB
/
Copy path_docker.yml
File metadata and controls
93 lines (83 loc) · 3.5 KB
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
# Reusable: docker build verification for every deployable service.
# The service list lives in .github/services-matrix.json — one file shared
# with docker-publish.yml. Adding a service means adding one JSON entry.
name: Docker Verify
on:
workflow_call: {}
permissions:
contents: read
jobs:
load-matrix:
name: Load Service Matrix
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
matrix: ${{ steps.m.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Read services matrix
id: m
run: |
jq -e 'type == "array" and length > 0' .github/services-matrix.json > /dev/null \
|| { echo "::error::.github/services-matrix.json must be a non-empty array"; exit 1; }
echo "matrix=$(jq -c . .github/services-matrix.json)" >> "$GITHUB_OUTPUT"
- name: Run registry-derived architecture contracts
env:
ULTI_STATIC_ONLY: '1'
run: bash scripts/dev/architecture-contract-test.sh
docker-verify:
name: Docker Build (${{ matrix.service.name }})
needs: load-matrix
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
service: ${{ fromJSON(needs.load-matrix.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- name: Build Docker image locally (no push)
id: build
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
with:
context: .
file: ${{ matrix.service.dockerfile }}
no-cache-filters: ${{ matrix.service.module && 'runtime' || 'production' }}
push: false
load: true
tags: local/ulticode-${{ matrix.service.name }}:${{ github.sha }}
build-args: |
SERVICE_MODULE=${{ matrix.service.module }}
SERVICE_ARTIFACT=${{ matrix.service.artifact }}
SERVICE_PORT=${{ matrix.service.port }}
SERVICE_HEALTH_PATH=${{ matrix.service.health_path }}
INSTALL_DOCKER_CLI=${{ matrix.service.install_docker_cli || false }}
SERVICE_HEALTHCHECK=${{ matrix.service.healthcheck || true }}
cache-from: type=gha,scope=verify-${{ matrix.service.name }}
cache-to: type=gha,mode=max,scope=verify-${{ matrix.service.name }},ignore-error=true
- name: Scan local image
id: scan
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 (Trivy v0.74.0)
env:
TRIVY_IMAGE_SRC: docker
with:
image-ref: local/ulticode-${{ matrix.service.name }}:${{ github.sha }}
format: json
output: ${{ runner.temp }}/${{ matrix.service.name }}.trivy.json
exit-code: '1'
ignore-unfixed: true
vuln-type: os,library
severity: HIGH,CRITICAL
version: v0.74.0
- name: Upload local Trivy report
if: ${{ always() && steps.scan.outcome != 'skipped' && steps.scan.outcome != '' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: trivy-verify-${{ matrix.service.name }}
path: ${{ runner.temp }}/${{ matrix.service.name }}.trivy.json
if-no-files-found: warn
retention-days: 30