Skip to content

Commit 2a51117

Browse files
tomassrnkaclaude
authored andcommitted
fix: don't re-download busybox in Docker, restore version tracking for local dev
- Dockerfile: build go directly instead of make build-local, so fetch-busybox doesn't overwrite the SHA256-verified binary - Makefile: restore stamp file for version tracking in local dev, only used by build-local/build-debug (not Docker) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 53d39c8 commit 2a51117

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

packages/orchestrator/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ bin
1111

1212
# Downloaded at build time from fc-busybox release
1313
pkg/template/build/core/systeminit/busybox
14-
pkg/template/build/core/systeminit/busybox.version
14+
pkg/template/build/core/systeminit/busybox.stamp

packages/orchestrator/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ COPY ./orchestrator/Makefile ./orchestrator/Makefile
4848
WORKDIR /build/orchestrator
4949

5050
ARG COMMIT_SHA
51-
RUN --mount=type=cache,target=/root/.cache/go-build make build-local COMMIT_SHA=${COMMIT_SHA}
51+
# Build directly (not via make build-local) to skip fetch-busybox — binary is already downloaded above.
52+
RUN --mount=type=cache,target=/root/.cache/go-build \
53+
CGO_ENABLED=1 GOOS=linux go build -o bin/orchestrator -ldflags "-X=main.commitSHA=${COMMIT_SHA}" . \
54+
&& CGO_ENABLED=1 GOOS=linux go build -o bin/clean-nfs-cache -ldflags "-X=main.commitSHA=${COMMIT_SHA}" ./cmd/clean-nfs-cache
5255

5356
FROM scratch
5457

packages/orchestrator/Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,19 @@ build:
2929

3030
BUSYBOX_VERSION ?= 1.36.1
3131
BUSYBOX_EMBED := pkg/template/build/core/systeminit/busybox
32-
BUSYBOX_VERSION_FILE := $(BUSYBOX_EMBED).version
32+
BUSYBOX_STAMP := $(BUSYBOX_EMBED).stamp
3333

34+
# Download busybox if missing or version/arch changed. For Docker builds,
35+
# the Dockerfile downloads and verifies the binary separately — this target
36+
# is only used by build-local and build-debug (local dev / CI).
3437
.PHONY: fetch-busybox
3538
fetch-busybox:
36-
@CURRENT=$$(cat $(BUSYBOX_VERSION_FILE) 2>/dev/null || echo ""); \
37-
if [ ! -f $(BUSYBOX_EMBED) ] || [ "$$CURRENT" != "$(BUSYBOX_VERSION)-$(BUILD_ARCH)" ]; then \
39+
@if [ ! -f $(BUSYBOX_EMBED) ] || [ "$$(cat $(BUSYBOX_STAMP) 2>/dev/null)" != "$(BUSYBOX_VERSION)-$(BUILD_ARCH)" ]; then \
3840
echo "Downloading busybox v$(BUSYBOX_VERSION) ($(BUILD_ARCH))..."; \
3941
curl -sfL -o $(BUSYBOX_EMBED).tmp "https://github.com/e2b-dev/fc-busybox/releases/download/v$(BUSYBOX_VERSION)/busybox_v$(BUSYBOX_VERSION)_$(BUILD_ARCH)" \
4042
&& mv $(BUSYBOX_EMBED).tmp $(BUSYBOX_EMBED) \
4143
&& chmod +x $(BUSYBOX_EMBED) \
42-
&& echo "$(BUSYBOX_VERSION)-$(BUILD_ARCH)" > $(BUSYBOX_VERSION_FILE) \
44+
&& echo "$(BUSYBOX_VERSION)-$(BUILD_ARCH)" > $(BUSYBOX_STAMP) \
4345
|| { rm -f $(BUSYBOX_EMBED).tmp; echo "ERROR: failed to download busybox"; exit 1; }; \
4446
fi
4547

0 commit comments

Comments
 (0)