@hybridlabor-api/aos 4.8.0 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/{agents.md → AGENTS.md} +3 -1
- package/.agents/nodes.json +3 -1
- package/.agents/vendor-manifest.json +23 -1
- package/.claude/agents/godmode-media-eventtech.md +1 -1
- package/.claude/hooks/conventional-commits.mjs +125 -0
- package/.claude/hooks/env-file-protection.mjs +105 -0
- package/.claude/hooks/go-gate.mjs +101 -81
- package/.claude/hooks/memb-inject.mjs +29 -1
- package/.claude/settings.json +13 -0
- package/.claude/workflows/startcycle-dispatch.mjs +23 -1
- package/.opencode/agents/godmode-media-eventtech.md +1 -1
- package/.opencode/plugins/bdb-aos.js +31 -4
- package/CLAUDE.md +0 -571
- package/README.de.md +1 -1
- package/README.md +1 -1
- package/README.pt.md +1 -1
- package/THIRD_PARTY_NOTICES.md +126 -0
- package/bin/aos-doctor.mjs +1 -1
- package/docs/skills_table.md +1 -1
- package/installer.js +187 -55
- package/package.json +7 -3
- package/packages/aos-cli/README.md +80 -0
- package/packages/aos-cli/bin/aos-cli.mjs +134 -0
- package/packages/aos-cli/core-skills.json +12 -0
- package/packages/aos-cli/extensions/aos.ts +321 -0
- package/packages/aos-cli/package-lock.json +1923 -0
- package/packages/aos-cli/package.json +29 -0
- package/packages/aos-cli/scripts/check-theme.mjs +63 -0
- package/packages/aos-cli/themes/aos.json +97 -0
- package/scripts/build-plugin-manifest.mjs +131 -0
- package/scripts/validate-skills.mjs +81 -6
- package/skills/basic/ao-orchestrator/SKILL.md +116 -0
- package/skills/basic/bdb-eventagency-skill/SKILL.md +252 -0
- package/skills/basic/bdb-shipping-skill/SKILL.md +161 -0
- package/skills/basic/godmode-eventtech/SKILL.md +4 -1
- package/skills/global_config/agenttrail/SKILL.md +6 -1
- package/skills/global_config/aos-project-init/SKILL.md +2 -0
- package/skills/global_config/aos-project-init/assets/AGENTS.template.md +1 -1
- package/skills/global_config/aos-project-init/scripts/aos-project-doctor.mjs +1 -1
- package/skills/global_config/aos-setup/SKILL.md +1 -1
- package/skills/global_config/aos-setup/scripts/aos-doctor.mjs +1 -1
- package/skills/global_config/ask-tim/SKILL.md +7 -7
- package/skills/global_config/bash-script-generator/SKILL.md +201 -0
- package/skills/global_config/bash-script-generator/assets/templates/standard-template.sh +96 -0
- package/skills/global_config/bash-script-generator/docs/bash-scripting-guide.md +729 -0
- package/skills/global_config/bash-script-generator/docs/generation-best-practices.md +193 -0
- package/skills/global_config/bash-script-generator/docs/script-patterns.md +566 -0
- package/skills/global_config/bash-script-generator/docs/text-processing-guide.md +437 -0
- package/skills/global_config/bash-script-generator/examples/log-analyzer.sh +92 -0
- package/skills/global_config/bash-script-generator/scripts/generate_script_template.sh +123 -0
- package/skills/global_config/bash-script-generator/scripts/run_ci_checks.sh +172 -0
- package/skills/global_config/bash-script-generator/scripts/test_generator.sh +413 -0
- package/skills/global_config/bash-script-validator/SKILL.md +249 -0
- package/skills/global_config/bash-script-validator/docs/awk-reference.md +449 -0
- package/skills/global_config/bash-script-validator/docs/bash-reference.md +468 -0
- package/skills/global_config/bash-script-validator/docs/common-mistakes.md +623 -0
- package/skills/global_config/bash-script-validator/docs/grep-reference.md +395 -0
- package/skills/global_config/bash-script-validator/docs/regex-reference.md +391 -0
- package/skills/global_config/bash-script-validator/docs/sed-reference.md +454 -0
- package/skills/global_config/bash-script-validator/docs/shell-reference.md +463 -0
- package/skills/global_config/bash-script-validator/docs/shellcheck-reference.md +399 -0
- package/skills/global_config/bash-script-validator/examples/bad-bash.sh +55 -0
- package/skills/global_config/bash-script-validator/examples/bad-shell.sh +54 -0
- package/skills/global_config/bash-script-validator/examples/good-bash.sh +71 -0
- package/skills/global_config/bash-script-validator/examples/good-shell.sh +69 -0
- package/skills/global_config/bash-script-validator/scripts/run_ci_checks.sh +23 -0
- package/skills/global_config/bash-script-validator/scripts/shellcheck_wrapper.sh +174 -0
- package/skills/global_config/bash-script-validator/scripts/test_validate.sh +446 -0
- package/skills/global_config/bash-script-validator/scripts/validate.sh +512 -0
- package/skills/global_config/ci-pipeline/SKILL.md +135 -0
- package/skills/global_config/deja-memory/SKILL.md +3 -1
- package/skills/global_config/dispatching-parallel-agents/SKILL.md +170 -0
- package/skills/global_config/dockerfile-generator/SKILL.md +1038 -0
- package/skills/global_config/dockerfile-generator/examples/example.dockerignore +95 -0
- package/skills/global_config/dockerfile-generator/examples/golang-distroless.Dockerfile +34 -0
- package/skills/global_config/dockerfile-generator/examples/java-springboot.Dockerfile +45 -0
- package/skills/global_config/dockerfile-generator/examples/nextjs-production.Dockerfile +49 -0
- package/skills/global_config/dockerfile-generator/examples/nodejs-multistage.Dockerfile +55 -0
- package/skills/global_config/dockerfile-generator/examples/python-fastapi.Dockerfile +48 -0
- package/skills/global_config/dockerfile-generator/references/language_specific_guides.md +510 -0
- package/skills/global_config/dockerfile-generator/references/multistage_builds.md +570 -0
- package/skills/global_config/dockerfile-generator/references/optimization_patterns.md +492 -0
- package/skills/global_config/dockerfile-generator/references/security_best_practices.md +375 -0
- package/skills/global_config/dockerfile-generator/scripts/generate_dockerignore.sh +199 -0
- package/skills/global_config/dockerfile-generator/scripts/generate_golang.sh +172 -0
- package/skills/global_config/dockerfile-generator/scripts/generate_java.sh +185 -0
- package/skills/global_config/dockerfile-generator/scripts/generate_nodejs.sh +279 -0
- package/skills/global_config/dockerfile-generator/scripts/generate_python.sh +218 -0
- package/skills/global_config/dockerfile-generator/scripts/test_generator.sh +210 -0
- package/skills/global_config/dockerfile-validator/SKILL.md +300 -0
- package/skills/global_config/dockerfile-validator/examples/.dockerignore.example +34 -0
- package/skills/global_config/dockerfile-validator/examples/bad-example.Dockerfile +37 -0
- package/skills/global_config/dockerfile-validator/examples/golang-distroless.Dockerfile +50 -0
- package/skills/global_config/dockerfile-validator/examples/good-example.Dockerfile +52 -0
- package/skills/global_config/dockerfile-validator/examples/python-optimized.Dockerfile +53 -0
- package/skills/global_config/dockerfile-validator/examples/security-issues.Dockerfile +42 -0
- package/skills/global_config/dockerfile-validator/references/docker_best_practices.md +348 -0
- package/skills/global_config/dockerfile-validator/references/optimization_guide.md +473 -0
- package/skills/global_config/dockerfile-validator/references/security_checklist.md +208 -0
- package/skills/global_config/dockerfile-validator/scripts/dockerfile-validate.sh +699 -0
- package/skills/global_config/dockerfile-validator/scripts/test_validate.sh +35 -0
- package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn-lock-read.Dockerfile +6 -0
- package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn.Dockerfile +6 -0
- package/skills/global_config/dockerfile-validator/tests/fixtures/from-platform-nonroot.Dockerfile +7 -0
- package/skills/global_config/dockerfile-validator/tests/test_regression.sh +164 -0
- package/skills/global_config/finishing-a-development-branch/SKILL.md +228 -0
- package/skills/global_config/github-actions-generator/SKILL.md +353 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/composite/action.yml +82 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/docker/Dockerfile +25 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/docker/action.yml +42 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/docker/entrypoint.sh +27 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/javascript/action.yml +33 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/javascript/index.js +50 -0
- package/skills/global_config/github-actions-generator/assets/templates/action/javascript/package.json +27 -0
- package/skills/global_config/github-actions-generator/assets/templates/workflow/basic_workflow.yml +242 -0
- package/skills/global_config/github-actions-generator/assets/templates/workflow/reusable_workflow.yml +106 -0
- package/skills/global_config/github-actions-generator/examples/README.md +147 -0
- package/skills/global_config/github-actions-generator/examples/actions/setup-node-cached/action.yml +93 -0
- package/skills/global_config/github-actions-generator/examples/caching/docker-buildkit.yml +256 -0
- package/skills/global_config/github-actions-generator/examples/security/dependency-review.yml +62 -0
- package/skills/global_config/github-actions-generator/examples/security/sbom-attestation.yml +119 -0
- package/skills/global_config/github-actions-generator/examples/triggers/chatops-commands.yml +475 -0
- package/skills/global_config/github-actions-generator/examples/triggers/repository-dispatch.yml +418 -0
- package/skills/global_config/github-actions-generator/examples/triggers/workflow-orchestration.yml +404 -0
- package/skills/global_config/github-actions-generator/examples/workflows/docker-build-push.yml +68 -0
- package/skills/global_config/github-actions-generator/examples/workflows/go-ci.yml +161 -0
- package/skills/global_config/github-actions-generator/examples/workflows/monorepo-ci.yml +340 -0
- package/skills/global_config/github-actions-generator/examples/workflows/multi-environment-deploy.yml +406 -0
- package/skills/global_config/github-actions-generator/examples/workflows/nodejs-ci.yml +122 -0
- package/skills/global_config/github-actions-generator/examples/workflows/python-ci.yml +157 -0
- package/skills/global_config/github-actions-generator/examples/workflows/scheduled-tasks.yml +376 -0
- package/skills/global_config/github-actions-generator/references/advanced-triggers.md +917 -0
- package/skills/global_config/github-actions-generator/references/best-practices.md +755 -0
- package/skills/global_config/github-actions-generator/references/common-actions.md +715 -0
- package/skills/global_config/github-actions-generator/references/custom-actions.md +320 -0
- package/skills/global_config/github-actions-generator/references/expressions-and-contexts.md +688 -0
- package/skills/global_config/github-actions-generator/references/modern-features.md +421 -0
- package/skills/global_config/github-actions-generator/scripts/test_generator.sh +344 -0
- package/skills/global_config/github-actions-templates/SKILL.md +7 -0
- package/skills/global_config/github-actions-validator/SKILL.md +576 -0
- package/skills/global_config/github-actions-validator/examples/README.md +88 -0
- package/skills/global_config/github-actions-validator/examples/outdated-versions.yml +76 -0
- package/skills/global_config/github-actions-validator/examples/valid-ci.yml +79 -0
- package/skills/global_config/github-actions-validator/examples/with-errors.yml +47 -0
- package/skills/global_config/github-actions-validator/references/act_usage.md +233 -0
- package/skills/global_config/github-actions-validator/references/action_versions.md +122 -0
- package/skills/global_config/github-actions-validator/references/actionlint_usage.md +343 -0
- package/skills/global_config/github-actions-validator/references/common_errors.md +512 -0
- package/skills/global_config/github-actions-validator/references/modern_features.md +384 -0
- package/skills/global_config/github-actions-validator/references/runners.md +317 -0
- package/skills/global_config/github-actions-validator/scripts/install_tools.sh +113 -0
- package/skills/global_config/github-actions-validator/scripts/validate_workflow.sh +910 -0
- package/skills/global_config/github-actions-validator/tests/test_validate_workflow.sh +237 -0
- package/skills/global_config/makefile-generator/SKILL.md +614 -0
- package/skills/global_config/makefile-generator/assets/templates/.gitkeep +1 -0
- package/skills/global_config/makefile-generator/docs/makefile-structure.md +530 -0
- package/skills/global_config/makefile-generator/docs/optimization-guide.md +784 -0
- package/skills/global_config/makefile-generator/docs/patterns-guide.md +642 -0
- package/skills/global_config/makefile-generator/docs/security-guide.md +361 -0
- package/skills/global_config/makefile-generator/docs/targets-guide.md +642 -0
- package/skills/global_config/makefile-generator/docs/variables-guide.md +596 -0
- package/skills/global_config/makefile-generator/scripts/add_standard_targets.sh +539 -0
- package/skills/global_config/makefile-generator/scripts/generate_makefile_template.sh +690 -0
- package/skills/global_config/makefile-generator/test/test_helper_scripts.sh +190 -0
- package/skills/global_config/makefile-validator/SKILL.md +244 -0
- package/skills/global_config/makefile-validator/docs/bake-tool.md +1000 -0
- package/skills/global_config/makefile-validator/docs/best-practices.md +858 -0
- package/skills/global_config/makefile-validator/docs/common-mistakes.md +944 -0
- package/skills/global_config/makefile-validator/examples/bad-makefile.mk +77 -0
- package/skills/global_config/makefile-validator/examples/good-makefile.mk +103 -0
- package/skills/global_config/makefile-validator/scripts/test_validate.sh +382 -0
- package/skills/global_config/makefile-validator/scripts/validate_makefile.sh +712 -0
- package/skills/global_config/{MCP_Manage → mcp-manage}/SKILL.md +3 -3
- package/skills/global_config/plan-canvas/SKILL.md +9 -2
- package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/ui.js +10 -2
- package/skills/global_config/plan-canvas/scripts/plan-canvas.js +1 -1
- package/skills/global_config/read-the-damn-docs/SKILL.md +175 -0
- package/skills/global_config/requesting-code-review/SKILL.md +98 -0
- package/skills/global_config/requesting-code-review/code-reviewer.md +198 -0
- package/skills/global_config/using-git-worktrees/SKILL.md +170 -0
- package/skills/global_config/verification-before-completion/SKILL.md +123 -0
- package/skills/global_config/writing-plans/SKILL.md +126 -46
- package/skills/global_config/writing-plans-legacy/SKILL.md +152 -0
- package/.claude/CLAUDE.md +0 -12
- package/mcps/RhinoMCP/docs/content/docs/getting-started/gemini.md +0 -61
- /package/{GEMINI.md → RULES.md} +0 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# Docker BuildKit Cache Example
|
|
2
|
+
# Demonstrates: GitHub Actions cache backend, inline vs registry cache, multi-stage build optimization
|
|
3
|
+
|
|
4
|
+
name: Docker Build with BuildKit Cache
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main, develop]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [main]
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
packages: write
|
|
16
|
+
|
|
17
|
+
env:
|
|
18
|
+
REGISTRY: ghcr.io
|
|
19
|
+
IMAGE_NAME: ${{ github.repository }}
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
# Example 1: Basic BuildKit with GitHub Actions Cache
|
|
23
|
+
build-with-gha-cache:
|
|
24
|
+
name: Build with GitHub Actions Cache Backend
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
timeout-minutes: 30
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- name: Checkout code
|
|
30
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
31
|
+
|
|
32
|
+
- name: Set up Docker Buildx
|
|
33
|
+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
|
|
34
|
+
|
|
35
|
+
- name: Log in to GitHub Container Registry
|
|
36
|
+
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
|
|
37
|
+
with:
|
|
38
|
+
registry: ${{ env.REGISTRY }}
|
|
39
|
+
username: ${{ github.actor }}
|
|
40
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
41
|
+
|
|
42
|
+
- name: Extract metadata
|
|
43
|
+
id: meta
|
|
44
|
+
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
|
|
45
|
+
with:
|
|
46
|
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
47
|
+
tags: |
|
|
48
|
+
type=ref,event=branch
|
|
49
|
+
type=ref,event=pr
|
|
50
|
+
type=sha,prefix={{branch}}-
|
|
51
|
+
|
|
52
|
+
# GitHub Actions Cache Backend
|
|
53
|
+
# - Stores cache in GitHub Actions cache (10 GB free per repo)
|
|
54
|
+
# - mode=max caches all build layers (not just final image)
|
|
55
|
+
# - Fastest option for most use cases
|
|
56
|
+
- name: Build and push (GHA cache)
|
|
57
|
+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
|
|
58
|
+
with:
|
|
59
|
+
context: .
|
|
60
|
+
platforms: linux/amd64,linux/arm64
|
|
61
|
+
push: ${{ github.event_name != 'pull_request' }}
|
|
62
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
63
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
64
|
+
cache-from: type=gha
|
|
65
|
+
cache-to: type=gha,mode=max
|
|
66
|
+
build-args: |
|
|
67
|
+
VERSION=${{ github.sha }}
|
|
68
|
+
|
|
69
|
+
# Example 2: Multi-Stage Build with Optimized Caching
|
|
70
|
+
build-multistage-optimized:
|
|
71
|
+
name: Multi-Stage Build with Cache Optimization
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
timeout-minutes: 30
|
|
74
|
+
|
|
75
|
+
steps:
|
|
76
|
+
- name: Checkout code
|
|
77
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
78
|
+
|
|
79
|
+
- name: Set up Docker Buildx
|
|
80
|
+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
|
|
81
|
+
|
|
82
|
+
- name: Log in to GitHub Container Registry
|
|
83
|
+
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
|
|
84
|
+
with:
|
|
85
|
+
registry: ${{ env.REGISTRY }}
|
|
86
|
+
username: ${{ github.actor }}
|
|
87
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
88
|
+
|
|
89
|
+
# Multi-stage builds benefit most from mode=max
|
|
90
|
+
# All intermediate stages are cached
|
|
91
|
+
- name: Build multi-stage with optimized cache
|
|
92
|
+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
|
|
93
|
+
with:
|
|
94
|
+
context: .
|
|
95
|
+
file: ./Dockerfile.multistage
|
|
96
|
+
target: production # Only build production stage
|
|
97
|
+
push: ${{ github.event_name != 'pull_request' }}
|
|
98
|
+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:multistage-${{ github.sha }}
|
|
99
|
+
cache-from: type=gha
|
|
100
|
+
cache-to: type=gha,mode=max
|
|
101
|
+
build-args: |
|
|
102
|
+
NODE_ENV=production
|
|
103
|
+
|
|
104
|
+
# Example 3: Registry Cache (for cross-runner sharing)
|
|
105
|
+
build-with-registry-cache:
|
|
106
|
+
name: Build with Registry Cache Backend
|
|
107
|
+
runs-on: ubuntu-latest
|
|
108
|
+
timeout-minutes: 30
|
|
109
|
+
|
|
110
|
+
steps:
|
|
111
|
+
- name: Checkout code
|
|
112
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
113
|
+
|
|
114
|
+
- name: Set up Docker Buildx
|
|
115
|
+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
|
|
116
|
+
|
|
117
|
+
- name: Log in to GitHub Container Registry
|
|
118
|
+
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
|
|
119
|
+
with:
|
|
120
|
+
registry: ${{ env.REGISTRY }}
|
|
121
|
+
username: ${{ github.actor }}
|
|
122
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
123
|
+
|
|
124
|
+
# Registry Cache Backend
|
|
125
|
+
# - Stores cache in container registry
|
|
126
|
+
# - Useful for sharing cache across different CI systems
|
|
127
|
+
# - Slower than GHA cache but more portable
|
|
128
|
+
# - Good for self-hosted runners
|
|
129
|
+
- name: Build and push (registry cache)
|
|
130
|
+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
|
|
131
|
+
with:
|
|
132
|
+
context: .
|
|
133
|
+
push: true
|
|
134
|
+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:registry-cache-${{ github.sha }}
|
|
135
|
+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
|
|
136
|
+
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
|
|
137
|
+
|
|
138
|
+
# Example 4: Inline Cache (embedded in image)
|
|
139
|
+
build-with-inline-cache:
|
|
140
|
+
name: Build with Inline Cache
|
|
141
|
+
runs-on: ubuntu-latest
|
|
142
|
+
timeout-minutes: 30
|
|
143
|
+
|
|
144
|
+
steps:
|
|
145
|
+
- name: Checkout code
|
|
146
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
147
|
+
|
|
148
|
+
- name: Set up Docker Buildx
|
|
149
|
+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
|
|
150
|
+
|
|
151
|
+
- name: Log in to GitHub Container Registry
|
|
152
|
+
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
|
|
153
|
+
with:
|
|
154
|
+
registry: ${{ env.REGISTRY }}
|
|
155
|
+
username: ${{ github.actor }}
|
|
156
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
157
|
+
|
|
158
|
+
# Inline Cache
|
|
159
|
+
# - Embeds cache metadata in the image itself
|
|
160
|
+
# - No separate cache artifact
|
|
161
|
+
# - Only caches layers in final image (not intermediate stages)
|
|
162
|
+
# - Useful when you can't use separate cache backends
|
|
163
|
+
- name: Build and push (inline cache)
|
|
164
|
+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
|
|
165
|
+
with:
|
|
166
|
+
context: .
|
|
167
|
+
push: true
|
|
168
|
+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:inline-cache-${{ github.sha }}
|
|
169
|
+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
170
|
+
cache-to: type=inline
|
|
171
|
+
|
|
172
|
+
# Example 5: Comparison and Best Practices
|
|
173
|
+
comparison-summary:
|
|
174
|
+
name: Cache Strategy Comparison
|
|
175
|
+
runs-on: ubuntu-latest
|
|
176
|
+
needs: [build-with-gha-cache, build-multistage-optimized, build-with-registry-cache, build-with-inline-cache]
|
|
177
|
+
if: always()
|
|
178
|
+
timeout-minutes: 5
|
|
179
|
+
|
|
180
|
+
steps:
|
|
181
|
+
- name: Generate cache strategy comparison
|
|
182
|
+
run: |
|
|
183
|
+
cat <<'EOF' >> $GITHUB_STEP_SUMMARY
|
|
184
|
+
## Docker BuildKit Cache Strategy Comparison
|
|
185
|
+
|
|
186
|
+
| Strategy | Speed | Cache Size | Use Case | Limitations |
|
|
187
|
+
|----------|-------|------------|----------|-------------|
|
|
188
|
+
| **GHA Cache** (`type=gha`) | ⚡ Fastest | Up to 10 GB free | Most workflows, GitHub-hosted runners | Limited to 10 GB per repo |
|
|
189
|
+
| **Registry Cache** (`type=registry`) | 🐌 Slower | Unlimited | Self-hosted runners, cross-CI sharing | Requires registry storage |
|
|
190
|
+
| **Inline Cache** (`type=inline`) | 🐌 Slowest | Embedded | When separate cache unavailable | Only caches final image layers |
|
|
191
|
+
|
|
192
|
+
### Recommendations
|
|
193
|
+
|
|
194
|
+
✅ **Use GHA Cache (`type=gha,mode=max`) for:**
|
|
195
|
+
- Standard CI/CD workflows
|
|
196
|
+
- Multi-stage builds (caches all stages)
|
|
197
|
+
- GitHub-hosted runners
|
|
198
|
+
- Fast rebuild times
|
|
199
|
+
|
|
200
|
+
✅ **Use Registry Cache (`type=registry`) for:**
|
|
201
|
+
- Self-hosted runners
|
|
202
|
+
- Sharing cache across different CI systems
|
|
203
|
+
- When you need >10 GB cache
|
|
204
|
+
- Cross-repository builds
|
|
205
|
+
|
|
206
|
+
⚠️ **Use Inline Cache (`type=inline`) only when:**
|
|
207
|
+
- You can't use GHA or registry cache
|
|
208
|
+
- Cache size is very small
|
|
209
|
+
- You only need final image layers cached
|
|
210
|
+
|
|
211
|
+
### Cache Modes
|
|
212
|
+
|
|
213
|
+
- `mode=min` - Only caches layers from final image (default)
|
|
214
|
+
- `mode=max` - Caches all layers including intermediate stages (recommended)
|
|
215
|
+
|
|
216
|
+
### Multi-Stage Build Optimization
|
|
217
|
+
|
|
218
|
+
For multi-stage Dockerfiles:
|
|
219
|
+
```dockerfile
|
|
220
|
+
# Base stage - cached separately
|
|
221
|
+
FROM node:24-alpine AS base
|
|
222
|
+
WORKDIR /app
|
|
223
|
+
COPY package*.json ./
|
|
224
|
+
RUN npm ci
|
|
225
|
+
|
|
226
|
+
# Build stage - cached separately
|
|
227
|
+
FROM base AS build
|
|
228
|
+
COPY . .
|
|
229
|
+
RUN npm run build
|
|
230
|
+
|
|
231
|
+
# Production stage - final image
|
|
232
|
+
FROM base AS production
|
|
233
|
+
COPY --from=build /app/dist ./dist
|
|
234
|
+
CMD ["node", "dist/index.js"]
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
With `mode=max`, all stages (base, build, production) are cached independently,
|
|
238
|
+
maximizing cache reuse on subsequent builds.
|
|
239
|
+
|
|
240
|
+
### Cache Key Strategy
|
|
241
|
+
|
|
242
|
+
BuildKit automatically generates cache keys based on:
|
|
243
|
+
- Dockerfile content
|
|
244
|
+
- Build context files referenced in COPY/ADD
|
|
245
|
+
- Build arguments
|
|
246
|
+
- Target platform
|
|
247
|
+
|
|
248
|
+
No manual cache key management needed! 🎉
|
|
249
|
+
EOF
|
|
250
|
+
|
|
251
|
+
echo "## Build Status Summary" >> $GITHUB_STEP_SUMMARY
|
|
252
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
253
|
+
echo "- GHA Cache: ${{ needs.build-with-gha-cache.result }}" >> $GITHUB_STEP_SUMMARY
|
|
254
|
+
echo "- Multi-stage: ${{ needs.build-multistage-optimized.result }}" >> $GITHUB_STEP_SUMMARY
|
|
255
|
+
echo "- Registry Cache: ${{ needs.build-with-registry-cache.result }}" >> $GITHUB_STEP_SUMMARY
|
|
256
|
+
echo "- Inline Cache: ${{ needs.build-with-inline-cache.result }}" >> $GITHUB_STEP_SUMMARY
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Dependency Review Workflow Example
|
|
2
|
+
# Demonstrates: Dependency scanning, license compliance, vulnerability detection
|
|
3
|
+
|
|
4
|
+
name: Dependency Review
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [main, develop]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
pull-requests: write # For commenting on PRs
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
dependency-review:
|
|
17
|
+
name: Review Dependencies and Licenses
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
timeout-minutes: 10
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout code
|
|
23
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
24
|
+
|
|
25
|
+
- name: Dependency Review
|
|
26
|
+
uses: actions/dependency-review-action@05fe4576374b728f0c523d6a13d64c25081e0803 # v4.8.3
|
|
27
|
+
with:
|
|
28
|
+
# Fail on critical and high severity vulnerabilities
|
|
29
|
+
fail-on-severity: high
|
|
30
|
+
|
|
31
|
+
# Allow specific licenses (adjust based on your policy)
|
|
32
|
+
allow-licenses: >
|
|
33
|
+
MIT,
|
|
34
|
+
Apache-2.0,
|
|
35
|
+
BSD-2-Clause,
|
|
36
|
+
BSD-3-Clause,
|
|
37
|
+
ISC,
|
|
38
|
+
0BSD
|
|
39
|
+
|
|
40
|
+
# Deny specific licenses (adjust based on your policy)
|
|
41
|
+
deny-licenses: >
|
|
42
|
+
GPL-3.0,
|
|
43
|
+
AGPL-3.0,
|
|
44
|
+
LGPL-3.0
|
|
45
|
+
|
|
46
|
+
# Fail on scopes (optional)
|
|
47
|
+
# fail-on-scopes: runtime
|
|
48
|
+
|
|
49
|
+
# Comment on PR with results (default: true)
|
|
50
|
+
comment-summary-in-pr: always
|
|
51
|
+
|
|
52
|
+
# Allow dependencies from specific sources
|
|
53
|
+
# allow-dependencies-licenses: pkg:npm/express@*
|
|
54
|
+
|
|
55
|
+
- name: Upload dependency graph
|
|
56
|
+
if: always()
|
|
57
|
+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
|
58
|
+
with:
|
|
59
|
+
name: dependency-graph
|
|
60
|
+
path: dependency-graph.json
|
|
61
|
+
retention-days: 7
|
|
62
|
+
if-no-files-found: ignore
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# SBOM Attestation Workflow Example
|
|
2
|
+
# Demonstrates: Software Bill of Materials generation and attestation for container images
|
|
3
|
+
|
|
4
|
+
name: Build and Attest Container Image
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
tags: ['v*']
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
packages: write
|
|
15
|
+
id-token: write
|
|
16
|
+
attestations: write
|
|
17
|
+
|
|
18
|
+
env:
|
|
19
|
+
REGISTRY: ghcr.io
|
|
20
|
+
IMAGE_NAME: ${{ github.repository }}
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
build-and-attest:
|
|
24
|
+
name: Build, Scan, and Attest Container Image
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
timeout-minutes: 30
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- name: Checkout code
|
|
30
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
31
|
+
|
|
32
|
+
- name: Set up Docker Buildx
|
|
33
|
+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
|
|
34
|
+
|
|
35
|
+
- name: Log in to GitHub Container Registry
|
|
36
|
+
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
|
|
37
|
+
with:
|
|
38
|
+
registry: ${{ env.REGISTRY }}
|
|
39
|
+
username: ${{ github.actor }}
|
|
40
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
41
|
+
|
|
42
|
+
- name: Extract metadata
|
|
43
|
+
id: meta
|
|
44
|
+
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
|
|
45
|
+
with:
|
|
46
|
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
47
|
+
tags: |
|
|
48
|
+
type=ref,event=branch
|
|
49
|
+
type=ref,event=pr
|
|
50
|
+
type=semver,pattern={{version}}
|
|
51
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
52
|
+
type=sha,prefix={{branch}}-
|
|
53
|
+
|
|
54
|
+
- name: Build and push Docker image
|
|
55
|
+
id: build
|
|
56
|
+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
|
|
57
|
+
with:
|
|
58
|
+
context: .
|
|
59
|
+
platforms: linux/amd64,linux/arm64
|
|
60
|
+
push: true
|
|
61
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
62
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
63
|
+
cache-from: type=gha
|
|
64
|
+
cache-to: type=gha,mode=max
|
|
65
|
+
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true
|
|
66
|
+
|
|
67
|
+
- name: Generate SBOM with Syft
|
|
68
|
+
uses: anchore/sbom-action@fbfd9c6c189226748411491745178e0c2017392d # v0.20.10
|
|
69
|
+
with:
|
|
70
|
+
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
|
|
71
|
+
format: spdx-json
|
|
72
|
+
output-file: sbom.spdx.json
|
|
73
|
+
upload-artifact: true
|
|
74
|
+
upload-release-assets: false
|
|
75
|
+
|
|
76
|
+
- name: Attest SBOM
|
|
77
|
+
uses: actions/attest-sbom@bd218ad0dbcb3e146bd073d1d9c6d78e08aa8a0b # v2.4.0
|
|
78
|
+
with:
|
|
79
|
+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
80
|
+
subject-digest: ${{ steps.build.outputs.digest }}
|
|
81
|
+
sbom-path: sbom.spdx.json
|
|
82
|
+
push-to-registry: true
|
|
83
|
+
|
|
84
|
+
- name: Scan image for vulnerabilities with Trivy
|
|
85
|
+
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
|
|
86
|
+
with:
|
|
87
|
+
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
|
|
88
|
+
format: sarif
|
|
89
|
+
output: trivy-results.sarif
|
|
90
|
+
severity: CRITICAL,HIGH
|
|
91
|
+
|
|
92
|
+
- name: Upload Trivy scan results to GitHub Security
|
|
93
|
+
uses: github/codeql-action/upload-sarif@ae9ef3a1d2e3413523c3741725c30064970cc0d4 # v3.32.5
|
|
94
|
+
if: always()
|
|
95
|
+
with:
|
|
96
|
+
sarif_file: trivy-results.sarif
|
|
97
|
+
category: container-scan
|
|
98
|
+
|
|
99
|
+
- name: Generate build provenance
|
|
100
|
+
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0
|
|
101
|
+
with:
|
|
102
|
+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
103
|
+
subject-digest: ${{ steps.build.outputs.digest }}
|
|
104
|
+
push-to-registry: true
|
|
105
|
+
|
|
106
|
+
- name: Summary
|
|
107
|
+
run: |
|
|
108
|
+
echo "## Container Image Built and Attested ✅" >> $GITHUB_STEP_SUMMARY
|
|
109
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
110
|
+
echo "**Image:** \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}\`" >> $GITHUB_STEP_SUMMARY
|
|
111
|
+
echo "**Digest:** \`${{ steps.build.outputs.digest }}\`" >> $GITHUB_STEP_SUMMARY
|
|
112
|
+
echo "**Tags:**" >> $GITHUB_STEP_SUMMARY
|
|
113
|
+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
|
114
|
+
echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
|
|
115
|
+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
|
116
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
117
|
+
echo "✅ SBOM generated and attested" >> $GITHUB_STEP_SUMMARY
|
|
118
|
+
echo "✅ Build provenance attested" >> $GITHUB_STEP_SUMMARY
|
|
119
|
+
echo "✅ Security scan completed" >> $GITHUB_STEP_SUMMARY
|