GitHub Action 的 podman 构建多架构的镜像时,报错 Error: buildah exited with code 1
报错信息:
exec container process `/bin/sh`: Exec format error
error building at STEP "RUN xxx": error while running runtime: exit status 1
time="2023-03-26T20:18:09Z" level=error msg="exit status 1"
Error: Error: buildah exited with code 1
原因:
因为未安装 QEMU,需要手动安装
# 在上一个动作 run 的最后执行
sudo apt install qemu-user-static -y
最终代码段为:
- name: Get Information
id: information
run: |
sudo apt install qemu-user-static -y
- name: Buildah Action
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE }}
tags: ${{ env.TAG }}
containerfiles: |
./Containerfile
platforms: linux/amd64,linux/arm64
context: .
extra-args: |
--squash
--timestamp 0