Skip to content

Commit a4eb9d7

Browse files
committed
Build developers local platform by default
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
1 parent b9169c6 commit a4eb9d7

3 files changed

Lines changed: 43 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ jobs:
203203

204204
- name: Build remaining artifacts (initrd and shim)
205205
run: |
206-
echo "Building shim, initrd and libkrun..."
207-
docker buildx bake shim initrd libkrun
206+
echo "Building host and guest binaries:"
207+
docker buildx bake host-binaries guest-binaries
208208
209209
- name: Verify all artifacts
210210
run: |

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ONI = "👹"
2323

2424
ARCH = $(shell uname -m)
2525
OS = $(shell uname -s)
26+
2627
LDFLAGS_x86_64_Linux = -lkrun
2728
LDFLAGS_aarch64_Linux = -lkrun
2829
LDFLAGS_arm64_Darwin = -L/opt/homebrew/lib -lkrun
@@ -52,10 +53,13 @@ GO_STATIC_LDFLAGS := -ldflags '-extldflags "-static" $(LDFLAGS) $(EXTRA_LDFLAGS)
5253
MODULE_NAME=$(shell go list -m)
5354
API_PACKAGES=$(shell ($(GO) list ${GO_TAGS} ./... | grep /api/ ))
5455

55-
.PHONY: clean all validate lint generate protos check-protos check-api-descriptors proto-fmt shell
56+
.PHONY: clean all build validate lint generate protos check-protos check-api-descriptors proto-fmt shell
57+
58+
all: build
5659

57-
all:
58-
$(BUILDX) bake
60+
build:
61+
@echo "$(WHALE) $@"
62+
HOST_OS=$(shell uname -s | tr '[:upper:]' '[:lower:]') KERNEL_ARCH=$(ARCH) $(BUILDX) bake
5963

6064
_output/containerd-shim-nerdbox-v1: cmd/containerd-shim-nerdbox-v1 FORCE
6165
@echo "$(WHALE) $@"

docker-bake.hcl

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
variable "HOST_OS" {
2+
default = "linux"
3+
}
4+
15
variable "KERNEL_VERSION" {
26
default = "6.12.44"
37
}
@@ -47,44 +51,66 @@ target "_common" {
4751
}
4852
}
4953

54+
target "_host_common" {
55+
inherits = ["_common"]
56+
args = {
57+
TARGETOS = HOST_OS
58+
}
59+
}
60+
61+
target "_guest_common" {
62+
inherits = ["_common"]
63+
args = {
64+
TARGETOS = "linux"
65+
}
66+
}
67+
5068
variable "DESTDIR" {
5169
default = "_output"
5270
}
5371

72+
group "default" {
73+
targets = ["host-binaries", "guest-binaries", "kernel"]
74+
}
75+
76+
group "host-binaries" {
77+
targets = ["shim", "libkrun"]
78+
}
79+
80+
group "guest-binaries" {
81+
targets = ["initrd"]
82+
}
83+
5484
target "menuconfig" {
5585
inherits = ["_common"]
5686
target = "kernel-build-base"
5787
output = ["type=image,name=nerdbox-menuconfig"]
5888
}
5989

6090
target "kernel" {
61-
inherits = ["_common"]
91+
inherits = ["_guest_common"]
6292
target = "kernel"
6393
output = ["${DESTDIR}"]
6494
}
6595

6696
target "initrd" {
67-
inherits = ["_common"]
97+
inherits = ["_guest_common"]
6898
target = "initrd"
6999
output = ["${DESTDIR}"]
70100
}
71101

72102
target "shim" {
73-
inherits = ["_common"]
103+
inherits = ["_host_common"]
74104
target = "shim"
75105
output = ["${DESTDIR}"]
76106
}
77107

78108
target "libkrun" {
79-
inherits = ["_common"]
109+
inherits = ["_host_common"]
80110
target = "libkrun"
81111
output = ["${DESTDIR}"]
82112
}
83113

84-
group "default" {
85-
targets = ["kernel", "initrd", "shim"]
86-
}
87-
88114
target "dev" {
89115
inherits = ["_common"]
90116
target = "dev"

0 commit comments

Comments
 (0)