withastro/astro

DevContainer on Apple Silicon/arm64 systems does not work

Opened this issue · 0 comments

Astro Info

n/a. Commit 6f4793656e6c911525c95afa570ca4a19ba11a3c in Astro repo.

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Trying to start the contribute to Astro dev container on apple silicon fails with a timeout on the vscode side because the docker container fails to build. The docker build log shows it fails on step 5:

11  RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
12    && curl -sSL https://dl.google.com/linux/direct/google-chrome-stable_current_$(dpkg --print-architecture).deb -o /tmp/chrome.deb \
13    && apt-get -y install /tmp/chrome.deb

with error

Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main arm64 Packages [8688 kB]
Get:5 http://deb.debian.org/debian bookworm-updates/main arm64 Packages [2708 B]
Get:6 http://deb.debian.org/debian-security bookworm-security/main arm64 Packages [203 kB]
Fetched 9148 kB in 3s (3020 kB/s)
Reading package lists...
Reading package lists...E: Invalid archive signature
E: Internal error, could not locate member control.tar{.zst,.lz4,.gz,.xz,.bz2,.lzma,}
E: Could not read meta data from /tmp/chrome.deb
E: The package lists or status file could not be parsed or opened.

It seems docker builds the image to match the host architecture and Google does not publish a Linux arm64 package of chrome.

What's the expected result?

It should build successfully and run on Apple Silicon and other Arm64 architecture machines.

We could modify the root dev container config to force it to build to amd64(ie x86) and transparently emulate with Rosetta on modern Docker setups by adding a platform argument. I don't believe this will have any impact on GitHub codespaces or other devcontainer spec using containerized dev environments, as they seem to all run on amd64 already.

diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 6b8edf605..ec38b8659 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,8 +1,10 @@
 {
   "name": "Contribute to Astro",
   "build": {
-    "dockerfile": "Dockerfile"
+    "dockerfile": "Dockerfile",
+    "options": ["--platform=linux/amd64"]
   },
+  "runArgs": ["--platform=linux/amd64"],
 
   "features": {
     "ghcr.io/devcontainers/features/desktop-lite:1": {}

Link to Minimal Reproducible Example

to reproduce clone astro on an arm64 machine and try to use the vscode dev containers extension to start the "Contribute to Astro" dev container with the "Dev Containers: Open Folder in Container..." command.

Participation

  • I am willing to submit a pull request for this issue.