-
Notifications
You must be signed in to change notification settings - Fork 7
[Maintenance] Upgrade development container to Debian 12, add Amazon Linux 2023 Support #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This commit resolves a series of build and runtime errors to create a stable,
portable, and fully automated dev container environment that works on both
`arm64` and `x86_64` architectures out-of-the-box.
- Stabilize Dockerfile Build:
- Upgrades the base image from `bullseye` to `bookworm`.
- Consolidates all `apt-get` dependencies into a single, correctly ordered
layer, installing necessary tools for cross-compilation
(`gcc-x86-64-linux-gnu`, `libc6-dev-amd64-cross`).
- Fixes `rustup` permission errors by installing the toolchain as `root`
and granting ownership to the `vscode` user.
- Adds `--break-system-packages` to the `pip install` command to comply
with Debian `bookworm`'s package management policies.
- Improve Architecture Portability:
- Makes the `bin/build` and `bin/test` scripts architecture-aware, allowing
them to run seamlessly on both `arm64` and `x86_64` hosts without manual
configuration.
- Fixes a bug that caused inconsistent naming of the shared library (`.so`)
file between build and test runs.
- Fix Container Startup on ARM64:
- Centralizes QEMU and `binfmt` setup within the `Dockerfile` build,
creating an architecture-aware initialization process.
- This allows for the removal of legacy, conflicting setup methods that
caused startup failures on `arm64` hosts:
- Removes the privileged `docker run` command for `qemu-user-static`
from the `postCreate` script.
- Disables the redundant QEMU setup in the `docker-in-docker` feature
by configuring `install-qemu: false` for the feature.
This commit implements a small refactor to make the dev container setup more resilient and truly multi-platform. - Installs `aarch64` cross-compilation packages (`gcc-aarch64-linux-gnu`, `libc6-dev-arm64-cross`) in the `Dockerfile` to enable building for ARM64 on x86_64 hosts. - Updates `bin/build-arch` to use the correct `strip` binary (native or cross-compile) by checking both the host and target architectures. - Adds a 30-second timeout to the `postCreate` script to prevent it from hanging if the Docker daemon fails to start. - Adds a comment to `bin/test` clarifying why language runtime tests are now enabled for all architectures. - Merges the `update-alternatives` command into the main `RUN` layer, reducing the total number of image layers.
This commit updates the CI configuration to resolve build failures and align the test environments with modern, supported versions. - Replaces deprecated `ubuntu-20.04` runners with `ubuntu-22.04` in the GitHub Actions workflow, fixing the hanging jobs. - Adds QEMU and Docker Buildx to `arm64` jobs to enable cross-platform image builds. - Upgrades the Debian test environment from a Bullseye-based image to a Bookworm-based one, and updates Node.js from v18 to v22 (LTS). - Updates the Python 2.7 test environment to use an `ubuntu:22.04` base image and installs Python 2.7 via the `deadsnakes` PPA.
|
@jeremiahlukus The Rust version upgrade was a typo, really. I was just upgrading the development base image from Bullseye to Bookworm, and getting the Test workflow green. I also added Amazon Linux 2023 to the Test workflow. Both Amazon Linux 2 and Bullseye are falling out of support soon, and it's good to get |
|
Additional notes:
|
|
Thanks for the clarification. Saw a wall of AI text and discredited you. I might be able to look into it tomorrow else I’ll look at it on Monday if all is good I’ll merge it. Removing the rust update makes it an easier task. |
|
Good to see you Brian. Hope you're doing well. @jeremiahlukus Brian is a trusted friend and co-worker from my times at Custom Ink. They owner/collaborators here. Brian does great work too. Just wanted to make some intros. I've got no stake in this project or technical opinion on how to move it forward but trust y'all got it covered. |
|
Hey @brcarp I didn’t forget just dealing with some other issues. A deer ran into me the other day and totaled my car so might be a couple days before things level out. |
Summary
This PR upgrades the development container from Debian 11 (Bullseye) to Debian 12 (Bookworm) and adds comprehensive support for Amazon Linux 2023 Lambda runtimes. All tests in the GitHub Actions
Testworkflow now pass, including new test jobs for Amazon Linux 2023 on both x86_64 and arm64 architectures.Changes
Development Container (
.devcontainer/)rust:1-1-bullseyetorust:1-1-bookwormgcc-x86-64-linux-gnu,gcc-aarch64-linux-gnu, and their associatedlibc-devpackagesbinfmtenablement for multi-architecture support/usr/local/rustupand/usr/local/cargotovscodeuserpostCreatescript with Docker daemon readiness check and timeout handlingdevcontainer.json: Disabled QEMU installation in docker-in-docker feature (already handled in Dockerfile)Amazon Linux 2023 Support (
amzn2023/)Created complete build and test infrastructure for AL2023:
amazonlinux:2023basenodejs:22runtime (AL2023-based)amzn/directory/root/.cargo/binpaths andWORKDIRdirectivesPython 2.7 Support (
py27/)wraptdependency: Pinned to<1.15.0 for Python 2.7compatibility (newer versions use f-strings)file,binutils,util-linux)Build System Improvements (
bin/)uname -m)stripcommand: Automatically uses correct cross-platform strip utilityGitHub Actions Workflow (
.github/workflows/)ubuntu-20.04toubuntu-22.04Notes
Key Discoveries and Pitfalls
/home/vscode/.rustup) failed becauseRUSTUP_HOMEandCARGO_HOMEenvironment variables weren't being respected in the devcontainer exec contextrustup's on-demand component installation requires write access to toolchain directories/usr/local, thenchowntovscodeuser for development flexibilitygcc-x86-64-linux-gnu).cargo/config.tomlstriputility for binary optimizationnodejs:22(notnodejs:20)nodejs:20and earlier are based on Amazon Linux 2nodejs:22is based on Amazon Linux 2023 with newer glibcwraptpackage dropped Python 2.7 support in version 2.0+wrapt>=1.10.4,<1.15.0in setup.pypostCreatehook was failing because Docker daemon wasn't readyMulti-Architecture Development
This project now supports seamless development on both ARM64 (Apple Silicon, Graviton) and x86_64 (Intel/AMD) host machines:
This ensures developers on ARM64 Macs can build/test x86_64 artifacts and vice versa, matching the multi-architecture nature of AWS Lambda deployments.
Future Consideration: Zig for Cross-Compilation
The extensive troubleshooting around cross-compilation toolchains, linker configuration, and architecture-specific utilities suggests a potential improvement for the future:
Zigas a cross-compilation toolchain.Zig provides:
gcc-x86-64-linux-gnu,gcc-aarch64-linux-gnu, etc.)cargo zigbuildThis could significantly simplify the Dockerfile and build scripts by eliminating the need for:
stripcommands.cargo/config.tomllinker configurationThe current solution works reliably, but Zig could make cross-compilation more maintainable as the project grows to support additional architectures or platforms.