Skip to content

Commit 442a905

Browse files
committed
describe how to build the image with a Bake file
1 parent 16cc6e4 commit 442a905

2 files changed

Lines changed: 40 additions & 7 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ jobs:
2727
runner:
2828
- "ubuntu-24.04"
2929
- "ubuntu-24.04-arm"
30+
env:
31+
CONTEXT: ${{ matrix.knots.context }}
32+
RUNNER: ${{ matrix.runner }}
33+
VERSION: ${{ matrix.knots.version }}
3034
steps:
3135
- uses: actions/checkout@v5
3236
- uses: docker/setup-buildx-action@v3
@@ -35,17 +39,12 @@ jobs:
3539
registry: ghcr.io
3640
username: ${{ github.actor }}
3741
password: ${{ secrets.GITHUB_TOKEN }}
38-
- uses: docker/build-push-action@v6
42+
- uses: docker/bake-action@v6
3943
with:
40-
build-args: |
41-
KNOTS_VERSION=${{ matrix.knots.version }}
42-
cache-from: type=registry,ref=ghcr.io/bcnbitcoinonly/bitcoin:v${{ matrix.knots.version }}-${{ matrix.runner }}
43-
cache-to: type=inline
44-
context: ${{ matrix.knots.context }}
4544
provenance: false
4645
push: true
4746
sbom: false
48-
tags: ghcr.io/bcnbitcoinonly/bitcoin:v${{ matrix.knots.version }}-${{ matrix.runner }}
47+
targets: knots
4948

5049
merge:
5150
name: Merge v${{ matrix.knots_version }}

docker-bake.hcl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
variable "CONTEXT" {
2+
type = string
3+
default = "cmake"
4+
description = "autotools up to v28.1.knots20250305, cmake after"
5+
}
6+
7+
variable "RUNNER" {
8+
type = string
9+
default = "ubuntu-24.04"
10+
description = "Runner that built the image"
11+
}
12+
13+
variable "VERSION" {
14+
type = string
15+
default = "29.2.knots20251110"
16+
description = "Version of Knots to build"
17+
}
18+
19+
group "default" {
20+
targets = ["knots"]
21+
}
22+
23+
target "knots" {
24+
args = {
25+
KNOTS_VERSION = "${VERSION}"
26+
}
27+
context = "${CONTEXT}"
28+
cache-to = [{type = "inline"}]
29+
cache-from = [{
30+
type = "registry"
31+
ref = "ghcr.io/bcnbitcoinonly/bitcoin:v${VERSION}-${RUNNER}"
32+
}]
33+
tags = ["ghcr.io/bcnbitcoinonly/bitcoin:v${VERSION}-${RUNNER}"]
34+
}

0 commit comments

Comments
 (0)