Skip to content

Commit 113be28

Browse files
committed
feat: scratch-based image with input validation and output customization (Closes #16)
- Multi-stage build: Alpine builder + scratch runtime (31.5 MB, -46%) - Input validation for SIZE, RUNTIME, WARMUP, LOOPS, TARGET - EMOJI/COLOR env vars with auto-detection and fallbacks - Graceful job skipping when test size < block size - Non-root execution (user 65534:65534) - Remove Docker Scout recommendations (incompatible with scratch)
1 parent c811f8e commit 113be28

File tree

6 files changed

+927
-62
lines changed

6 files changed

+927
-62
lines changed

.github/workflows/codeql.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
schedule:
13+
- cron: "0 6 * * 1"
14+
workflow_dispatch:
15+
16+
jobs:
17+
analyze:
18+
name: Analyze
19+
runs-on: ubuntu-latest
20+
permissions:
21+
actions: read
22+
contents: read
23+
security-events: write
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
language:
29+
- actions
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
- name: Initialize CodeQL
36+
uses: github/codeql-action/init@v3
37+
with:
38+
languages: ${{ matrix.language }}
39+
queries: security-and-quality
40+
41+
- name: Perform CodeQL Analysis
42+
uses: github/codeql-action/analyze@v3
43+
with:
44+
category: "/language:${{ matrix.language }}"

.github/workflows/docker-image.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
branches:
1111
- main
1212
schedule:
13-
- cron: '0 0 * * *'
13+
- cron: "0 6 * * 1"
1414
workflow_dispatch:
1515

1616
permissions:
@@ -24,6 +24,8 @@ env:
2424
jobs:
2525
build:
2626
runs-on: ubuntu-latest
27+
env:
28+
HAS_DOCKERHUB_SECRETS: ${{ github.event_name != 'pull_request' || github.repository == github.event.pull_request.head.repo.full_name }}
2729
steps:
2830
- name: Checkout
2931
uses: actions/checkout@v4
@@ -32,6 +34,7 @@ jobs:
3234
- name: Set up Docker Buildx
3335
uses: docker/setup-buildx-action@v3
3436
- name: Login to Docker Hub
37+
if: ${{ env.HAS_DOCKERHUB_SECRETS }}
3538
uses: docker/login-action@v3
3639
with:
3740
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -64,6 +67,7 @@ jobs:
6467
with:
6568
context: .
6669
platforms: ${{ env.PLATFORMS }}
70+
pull: true
6771
cache-from: type=gha
6872
cache-to: type=gha
6973
push: true
@@ -74,17 +78,15 @@ jobs:
7478
if: ${{ github.event_name == 'pull_request' }}
7579
uses: docker/scout-action@v1
7680
with:
77-
command: cves,recommendations,compare
81+
command: cves,compare
7882
image: ${{ steps.meta.outputs.tags }}
7983
to: ${{ vars.GHCR_IMAGE }}:latest
80-
ignore-base: true
8184
ignore-unchanged: true
8285
only-fixed: true
83-
# only-severities: critical,high
8486
write-comment: true
8587
github-token: ${{ secrets.GITHUB_TOKEN }}
8688
- name: Update repo description
87-
if: ${{ github.ref == 'refs/heads/main' }}
89+
if: ${{ github.ref == 'refs/heads/main' && env.HAS_DOCKERHUB_SECRETS }}
8890
uses: peter-evans/dockerhub-description@v4
8991
with:
9092
username: ${{ secrets.DOCKERHUB_USERNAME }}

0 commit comments

Comments
 (0)