buildah-build icon indicating copy to clipboard operation
buildah-build copied to clipboard

[QUESTION]I'm having difficulty building a multi-arch image because the TARGETPLATFORM variable is not available in older buildah versions.

Open daiaji opened this issue 2 years ago • 2 comments

https://github.com/containers/buildah/pull/3899/commits/bee0a1ff2ef91dc819d28317d7f20cf946b1dc25 Basically, it can be confirmed that the TARGETPLATFORM variable of buildah earlier than 1.26.0 is faulty. But even the buildah version in the Ubuntu 22.04 software source is only 1.23.1. This is obviously not enough, so I tried to install a higher version of buildah, but encountered difficulties. https://github.com/actions/virtual-environments/issues/2703#issuecomment-1186525467

sudo apt-get install -y buildah -o Dpkg::Options::="--force-overwrite" But I'm lucky. This order works. However, it may be necessary to inform this fault in the document.

Examples. $ buildah build --platform linux/arm64 .

FROM --platform=$BUILDPLATFORM alpine
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I'm compiling for $TARGETPLATFORM on $BUILDPLATFORM and tagging for $TARGETPLATFORM"

Wrong output. I'm compiling for linux/amd64 on linux/amd64 and tagging for linux/amd64

Correct output. I'm compiling for linux/arm64 on linux/amd64 and tagging for linux/arm64

daiaji avatar Jul 16 '22 15:07 daiaji