File tree Expand file tree Collapse file tree 7 files changed +32
-9
lines changed
pkg/template/build/core/systeminit Expand file tree Collapse file tree 7 files changed +32
-9
lines changed Original file line number Diff line number Diff line change 88.shared
99/tmp
1010.local-build
11+
12+ # Downloaded at build time from fc-busybox release
13+ pkg /template /build /core /systeminit /busybox
Original file line number Diff line number Diff line change @@ -3,7 +3,13 @@ ARG GOLANG_VERSION=1.25.4
33# It has to match with the host OS version (Ubuntu 22.04 = bookworm)
44ARG DEBIAN_VERSION=bookworm
55
6+ # Busybox version from fc-busybox GitHub release.
7+ # TARGETARCH is set automatically by Docker --platform.
8+ ARG BUSYBOX_VERSION=1.36.1
9+
610FROM golang:${GOLANG_VERSION}-${DEBIAN_VERSION} AS builder
11+ ARG BUSYBOX_VERSION
12+ ARG TARGETARCH
713
814# Cached golang dependencies
915WORKDIR /build/shared
@@ -24,6 +30,10 @@ WORKDIR /build
2430COPY ./shared/pkg ./shared/pkg
2531COPY ./clickhouse/pkg ./clickhouse/pkg
2632
33+ # Download busybox from fc-busybox release for go:embed
34+ ADD https://github.com/e2b-dev/fc-busybox/releases/download/v${BUSYBOX_VERSION}/busybox_v${BUSYBOX_VERSION}_${TARGETARCH} \
35+ ./orchestrator/pkg/template/build/core/systeminit/busybox
36+
2737COPY ./orchestrator/pkg ./orchestrator/pkg
2838COPY ./orchestrator/cmd ./orchestrator/cmd
2939COPY ./orchestrator/main.go ./orchestrator/main.go
Original file line number Diff line number Diff line change @@ -27,15 +27,26 @@ build:
2727 $(eval COMMIT_SHA := $(shell git rev-parse --short HEAD) )
2828 @docker build --platform $(BUILD_PLATFORM ) --output=bin --build-arg COMMIT_SHA=" $( COMMIT_SHA) " -f ./Dockerfile ..
2929
30+ BUSYBOX_VERSION ?= 1.36.1
31+ BUSYBOX_EMBED := pkg/template/build/core/systeminit/busybox
32+
33+ .PHONY : fetch-busybox
34+ fetch-busybox :
35+ @if [ ! -f $( BUSYBOX_EMBED) ]; then \
36+ echo " Downloading busybox v$( BUSYBOX_VERSION) ($( BUILD_ARCH) )..." ; \
37+ curl -sL -o $(BUSYBOX_EMBED ) " https://github.com/e2b-dev/fc-busybox/releases/download/v$( BUSYBOX_VERSION) /busybox_v$( BUSYBOX_VERSION) _$( BUILD_ARCH) " ; \
38+ chmod +x $(BUSYBOX_EMBED ) ; \
39+ fi
40+
3041.PHONY : build-local
31- build-local :
42+ build-local : fetch-busybox
3243 # Allow for passing commit sha directly for docker builds
3344 $(eval COMMIT_SHA ?= $(shell git rev-parse --short HEAD) )
3445 CGO_ENABLED=1 GOOS=linux GOARCH=$(BUILD_ARCH ) go build -o bin/orchestrator -ldflags " -X=main.commitSHA=$( COMMIT_SHA) " .
3546 CGO_ENABLED=1 GOOS=linux GOARCH=$(BUILD_ARCH ) go build -o bin/clean-nfs-cache -ldflags " -X=main.commitSHA=$( COMMIT_SHA) " ./cmd/clean-nfs-cache
3647
3748.PHONY : build-debug
38- build-debug :
49+ build-debug : fetch-busybox
3950 CGO_ENABLED=1 GOOS=linux GOARCH=$(BUILD_ARCH ) go build -race -gcflags=all=" -N -l" -o bin/orchestrator .
4051
4152.PHONY : run-debug
Original file line number Diff line number Diff line change 11//go:build amd64
22
3- // Busybox v1.36.1 static binary for amd64 (musl, minimal ~16 applets) .
4- // Custom build added in #1002 — origin unknown, no distro tag in binary .
3+ // Busybox static binary for amd64.
4+ // Downloaded from https://github.com/e2b-dev/fc-busybox/releases at build time .
55
66package systeminit
77
88import _ "embed"
99
10- //go:embed busybox_1.36.1-2_amd64
10+ //go:embed busybox
1111var BusyboxBinary []byte
Original file line number Diff line number Diff line change 11//go:build arm64
22
3- // Busybox v1.36.1 static binary for arm64 (glibc, full 271 applets).
4- // Source: Debian busybox-static 1:1.36.1-9 (https://packages.debian.org/busybox-static)
5- // TODO: rebuild both binaries from the same minimal config for consistency.
3+ // Busybox static binary for arm64.
4+ // Downloaded from https://github.com/e2b-dev/fc-busybox/releases at build time.
65
76package systeminit
87
98import _ "embed"
109
11- //go:embed busybox_1.36.1-2_arm64
10+ //go:embed busybox
1211var BusyboxBinary []byte
You can’t perform that action at this time.
0 commit comments