Open DavidHospital opened 9 months ago
I have the same issue, please help!
If you're working on a Linux system, there is a way to run cross-architecture containers - user-mode QEMU is your friend.
Instructions for Debian+Podman:
apt install qemu-user-static podman
# might need to reboot here, to enable qemu's binfmt_misc hooks
podman run -ti --rm --arch aarch64 public.ecr.aws/codebuild/amazonlinux2-aarch64-standard:2.0
This will treat the container like any other, but now the kernel will recognize that the executables are for a different CPU architecture and automatically execute them with the corresponding qemu emulator. System calls are translated and handed off to the native kernel, so the performance impact is actually not so bad in many cases.
Should also work in a similar fashion on RPM-based distributions and/or Docker (but I haven't tested it).
I have a Lambda function with
arm64
architecture running Python 3.9, which is deployed to our production environment using CodePipeline using the amazonlinux2-aarch64-standard:2.0 image. This all works fine. By using this image,aarch64
versions of the python dependencies for the Lambda can be installed usingbuildspec.yml
and tools likepytest
can run in anaarch64
environment during the build process.The problem arises when building and deploying a copy of the lambda for development purposes by building locally using the
codebuild_build.sh
script. Since my machine hasx86_64
architecture, this fails (logs below).Describe the issue Unable to run
public.ecr.aws/codebuild/amazonlinux2-x86_64-standard:4.0
codebuild image usingcodebuild_build.sh
on anx86_64
machine.To Reproduce Steps to reproduce the behavior:
amazonlinux2-aarch64-standard:2.0
docker image on an x86_64 machine./build_scripts/local/codebuild_build.sh -i aws/codebuild/amazonlinux2-aarch64-standard:2.0 -a tmp/
Expected behavior Build should run without issue.
Logs
Platform (please complete the following information):