chainguard-dev / apko

Build OCI images from APK packages directly without Dockerfile
https://apko.dev
Apache License 2.0
1.21k stars 125 forks source link

Multi-arch build fails in GitHub action with `/bin/busybox: Exec format error` #335

Closed SoMuchForSubtlety closed 2 years ago

SoMuchForSubtlety commented 2 years ago

config:

contents:
  repositories:
    - https://dl-cdn.alpinelinux.org/alpine/latest-stable/main
    - https://dl-cdn.alpinelinux.org/alpine/latest-stable/community
  packages:
    - alpine-baselayout
    - ffmpeg
accounts:
  groups:
    - groupname: svc
      gid: 10000
  users:
    - username: svc
      uid: 10000
  run-as: svc

archs:
  - amd64
  - arm64

workflow file: https://github.com/MemeLabs/strims/actions/runs/2922854653/workflow logs: https://github.com/MemeLabs/strims/runs/8005777547?check_suite_focus=true#step:4:244

relevant part:

Aug 24 23:06:05.423 [INFO] [arch:aarch64] creating group 10000(svc)
Aug 24 23:06:05.425 [INFO] [arch:aarch64] [cmd:/bin/busybox] [use-proot:false] [use-qemu:] running: /usr/sbin/chroot /tmp/apko-1875477164/aarch64 /bin/busybox --install -s
Aug 24 23:06:05.427 [DEBUG] [arch:aarch64] [cmd:/bin/busybox] [use-proot:false] [use-qemu:] chroot: can't execute '/bin/busybox': Exec format error
Error: failed to build layer image for "arm64": failed to install busybox symlinks: failed to install busybox symlinks: exit status 126
2022/08/24 23:07:02 error during command execution: failed to build layer image for "arm64": failed to install busybox symlinks: failed to install busybox symlinks: exit status 126

Running the same command locally works as expected.

kaniini commented 2 years ago

You need to do the docker/setup-binfmt-action before using apko on github actions, or pass --arch x86_64.