Skip to content

Commit ef1044d

Browse files
tomassrnkaclaude
authored andcommitted
feat: download busybox from fc-busybox release instead of embedding
Download busybox binary from e2b-dev/fc-busybox GitHub release at Docker build time (via ADD) and at local build time (via curl in Makefile). Removes ~3.2MB of committed binaries from git. - Dockerfile: ADD from GitHub release, uses TARGETARCH - Makefile: fetch-busybox target for local dev builds - Both amd64 and arm64 binaries from same reproducible CI build Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d1f0ef6 commit ef1044d

File tree

7 files changed

+32
-9
lines changed

7 files changed

+32
-9
lines changed

packages/orchestrator/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ bin
88
.shared
99
/tmp
1010
.local-build
11+
12+
# Downloaded at build time from fc-busybox release
13+
pkg/template/build/core/systeminit/busybox

packages/orchestrator/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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)
44
ARG 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+
610
FROM golang:${GOLANG_VERSION}-${DEBIAN_VERSION} AS builder
11+
ARG BUSYBOX_VERSION
12+
ARG TARGETARCH
713

814
# Cached golang dependencies
915
WORKDIR /build/shared
@@ -24,6 +30,10 @@ WORKDIR /build
2430
COPY ./shared/pkg ./shared/pkg
2531
COPY ./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+
2737
COPY ./orchestrator/pkg ./orchestrator/pkg
2838
COPY ./orchestrator/cmd ./orchestrator/cmd
2939
COPY ./orchestrator/main.go ./orchestrator/main.go

packages/orchestrator/Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff 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
Binary file not shown.
Binary file not shown.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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

66
package systeminit
77

88
import _ "embed"
99

10-
//go:embed busybox_1.36.1-2_amd64
10+
//go:embed busybox
1111
var BusyboxBinary []byte
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
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

76
package systeminit
87

98
import _ "embed"
109

11-
//go:embed busybox_1.36.1-2_arm64
10+
//go:embed busybox
1211
var BusyboxBinary []byte

0 commit comments

Comments
 (0)