Open agirault opened 1 year ago
Found a workaround by using a additional dummy stage:
# syntax=docker/dockerfile:1
ARG BASE=ubuntu:20.04
FROM ${BASE} AS test-arm64
RUN echo "I am arm64" > /opt/who
FROM ${BASE} AS test-amd64
RUN echo "I am amd64" > /opt/who
FROM test-${TARGETARCH} AS test
FROM ${BASE} AS final
COPY --from=test /opt/who /opt/who
RUN cat /opt/who
Contributing guidelines
I've found a bug and checked that ...
Description
Using
TARGETARCH
or other automatic platform args in the global scope in a stage name will result in an error due to it not being lowercaseExpected behaviour
${TARGETARCH}
should be resolved toarm64
oramd64
resulting in a valid lowercase stage. The build should succeed and copy from the adequate stage, given behavior changes between both archs (basically if/else in dockerfile)Actual behaviour
Buildx version
github.com/docker/buildx v0.10.4 c513d34
Builders list
Configuration