Skip to content

Commit f99f9ed

Browse files
authored
fix macos local dev (#249)
life happens fast <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes the build/run platform for the chromium Docker images, which can affect local dev behavior and may break workflows that relied on native `arm64` images without explicitly overriding the platform. > > **Overview** > For the `chromium-headful` and `chromium-headless` images, the build scripts now pass `--platform "$DOCKER_PLATFORM"` to `docker build`, and the run scripts include `--platform "$DOCKER_PLATFORM"` in `docker run`. > > `ensure-common-build-run-vars.sh` introduces `DOCKER_PLATFORM` (defaulting to `linux/amd64`) with rationale for Chrome-for-Testing on Apple Silicon, allowing overrides for custom `arm64` images. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 2689339. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 5ca3cf3 commit f99f9ed

5 files changed

Lines changed: 10 additions & 2 deletions

File tree

images/chromium-headful/build-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ source ../../shared/start-buildkit.sh
1010

1111
# Build the Docker image using the repo root as build context
1212
# so the Dockerfile's first stage can access the server sources
13-
(cd "$SCRIPT_DIR/../.." && docker build -f images/chromium-headful/Dockerfile -t "$IMAGE" .)
13+
(cd "$SCRIPT_DIR/../.." && docker build --platform "$DOCKER_PLATFORM" -f images/chromium-headful/Dockerfile -t "$IMAGE" .)

images/chromium-headful/run-docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ cat "$FLAGS_FILE"
5252
# Build docker run argument list
5353
RUN_ARGS=(
5454
--name "$NAME"
55+
--platform "$DOCKER_PLATFORM"
5556
--privileged
5657
--tmpfs /dev/shm:size=2g
5758
-v "$HOST_RECORDINGS_DIR:/recordings"

images/chromium-headless/build-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ source ../../shared/start-buildkit.sh
1010

1111
# Build the Docker image using the repo root as build context
1212
# so the Dockerfile's first stage can access the server sources
13-
(cd "$SCRIPT_DIR/../.." && docker build -f images/chromium-headless/image/Dockerfile -t "$IMAGE" .)
13+
(cd "$SCRIPT_DIR/../.." && docker build --platform "$DOCKER_PLATFORM" -f images/chromium-headless/image/Dockerfile -t "$IMAGE" .)

images/chromium-headless/run-docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mkdir -p "$HOST_RECORDINGS_DIR"
1212

1313
RUN_ARGS=(
1414
--name "$NAME"
15+
--platform "$DOCKER_PLATFORM"
1516
--privileged
1617
--tmpfs /dev/shm:size=2g
1718
-p 9222:9222

shared/ensure-common-build-run-vars.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ NAME="${NAME:-${IMAGE_TYPE}-test}"
1616

1717
UKC_INDEX="${UKC_INDEX:-index.unikraft.io}"
1818

19+
# Chrome-for-Testing only ships linux/amd64 binaries, so both images must be
20+
# built and run for amd64 even on arm64 hosts (Apple Silicon). Docker Desktop
21+
# will emulate via Rosetta. Override with DOCKER_PLATFORM=linux/arm64 only if
22+
# you have a compatible chromium baked into a custom Dockerfile.
23+
DOCKER_PLATFORM="${DOCKER_PLATFORM:-linux/amd64}"
24+
1925
# Only require UKC_TOKEN and UKC_METRO when explicitly requested
2026
# Pass "require-ukc-vars" as second argument to enable this check
2127
REQUIRE_UKC_VARS="${2:-}"

0 commit comments

Comments
 (0)