1313 # Allow manual triggering
1414 workflow_dispatch :
1515
16+ # Allow triggering via external webhooks (e.g., to rebuild images regularly)
17+ repository_dispatch :
18+ types : [ trigger-container-build ]
19+
1620permissions :
1721 contents : read
1822 packages : write
23+ # REQUIRED: Allow uploading security results to the Security tab
24+ security-events : write
1925
2026env :
2127 REGISTRY : ghcr.io
3339 contents : read
3440 packages : write
3541 id-token : write
42+ security-events : write # Required within the job context as well
3643
3744 steps :
3845 - name : Checkout repository
4855 username : ${{ github.actor }}
4956 password : ${{ secrets.GITHUB_TOKEN }}
5057
51- # Set up QEMU to enable multi-platform emulation (required for building arm64 on amd64 runners)
58+ # Set up QEMU to enable multi-platform emulation
5259 - name : Set up QEMU
5360 uses : docker/setup-qemu-action@v3
5461 with :
@@ -78,13 +85,31 @@ jobs:
7885 file : flavors/hermes/Containerfile
7986 platforms : linux/amd64,linux/arm64
8087 push : true
81- # Instructs Buildx to map the local base image reference to the newly built GHCR image
8288 build-contexts : |
8389 ai-agent-sandbox:base=docker-image://ghcr.io/migoller/ai-agent-sandbox-base:latest
8490 tags : |
8591 ghcr.io/migoller/ai-agent-sandbox-hermes:latest
8692 ghcr.io/migoller/ai-agent-sandbox-hermes:${{ github.sha }}
8793
94+ # Step 2.5: Trivy Image Scan for Hermes
95+ - name : Run Trivy scanner on Hermes image
96+ uses : aquasecurity/trivy-action@v0.36.0
97+ with :
98+ scan-type : ' image'
99+ image-ref : ' ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.HERMES_IMAGE_NAME }}:latest'
100+ format : ' sarif'
101+ output : ' trivy-hermes-results.sarif'
102+ exit-code : ' 0'
103+ ignore-unfixed : true
104+ severity : ' CRITICAL,HIGH'
105+
106+ - name : Upload Hermes scan results to GitHub Security tab
107+ uses : github/codeql-action/upload-sarif@v3
108+ if : always()
109+ with :
110+ sarif_file : ' trivy-hermes-results.sarif'
111+ category : ' image-hermes'
112+
88113 # Step 3: Build & Push Multi-Architecture Aider Flavor Image
89114 - name : Build and push Aider flavor
90115 uses : docker/build-push-action@v6
@@ -93,13 +118,31 @@ jobs:
93118 file : flavors/aider/Containerfile
94119 platforms : linux/amd64,linux/arm64
95120 push : true
96- # Map the local base reference for dependency resolution
97121 build-contexts : |
98122 ai-agent-sandbox:base=docker-image://ghcr.io/migoller/ai-agent-sandbox-base:latest
99123 tags : |
100124 ghcr.io/migoller/ai-agent-sandbox-aider:latest
101125 ghcr.io/migoller/ai-agent-sandbox-aider:${{ github.sha }}
102126
127+ # Step 3.5: Trivy Image Scan for Aider
128+ - name : Run Trivy scanner on Aider image
129+ uses : aquasecurity/trivy-action@v0.36.0
130+ with :
131+ scan-type : ' image'
132+ image-ref : ' ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.AIDER_IMAGE_NAME }}:latest'
133+ format : ' sarif'
134+ output : ' trivy-aider-results.sarif'
135+ exit-code : ' 0'
136+ ignore-unfixed : true
137+ severity : ' CRITICAL,HIGH'
138+
139+ - name : Upload Aider scan results to GitHub Security tab
140+ uses : github/codeql-action/upload-sarif@v3
141+ if : always()
142+ with :
143+ sarif_file : ' trivy-aider-results.sarif'
144+ category : ' image-aider'
145+
103146 # Step 4: Build & Push Multi-Architecture Claude-Code Flavor Image
104147 - name : Build and push Claude-Code flavor
105148 uses : docker/build-push-action@v6
@@ -108,14 +151,32 @@ jobs:
108151 file : flavors/claude-code/Containerfile
109152 platforms : linux/amd64,linux/arm64
110153 push : true
111- # Map the local base reference for dependency resolution
112154 build-contexts : |
113155 ai-agent-sandbox:base=docker-image://ghcr.io/migoller/ai-agent-sandbox-base:latest
114156 tags : |
115157 ghcr.io/migoller/ai-agent-sandbox-claude-code:latest
116158 ghcr.io/migoller/ai-agent-sandbox-claude-code:${{ github.sha }}
159+
160+ # Step 4.5: Trivy Image Scan for Claude-Code
161+ - name : Run Trivy scanner on Claude-Code image
162+ uses : aquasecurity/trivy-action@v0.36.0
163+ with :
164+ scan-type : ' image'
165+ image-ref : ' ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.CLAUDE_IMAGE_NAME }}:latest'
166+ format : ' sarif'
167+ output : ' trivy-claude-results.sarif'
168+ exit-code : ' 0'
169+ ignore-unfixed : true
170+ severity : ' CRITICAL,HIGH'
171+
172+ - name : Upload Claude-Code scan results to GitHub Security tab
173+ uses : github/codeql-action/upload-sarif@v3
174+ if : always()
175+ with :
176+ sarif_file : ' trivy-claude-results.sarif'
177+ category : ' image-claude-code'
117178
118- # 5. Generate Dynamic Release Summary (Directly visible in GitHub Actions UI)
179+ # 5. Generate Dynamic Release Summary
119180 - name : Create release notes summary
120181 run : |
121182 {
@@ -128,4 +189,4 @@ jobs:
128189 echo "- **Hermes:** \`${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.HERMES_IMAGE_NAME }}:latest\`"
129190 echo "- **Aider:** \`${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.AIDER_IMAGE_NAME }}:latest\`"
130191 echo "- **Claude Code:** \`${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.CLAUDE_IMAGE_NAME }}:latest\`"
131- } >> $GITHUB_STEP_SUMMARY
192+ } >> $GITHUB_STEP_SUMMARY
0 commit comments