container icon indicating copy to clipboard operation
container copied to clipboard

Native builder: add the current target platform we're building use it to set automatic platform ARGs

Open dkovba opened this issue 1 year ago • 2 comments

Feature or enhancement request details

We should add the current target platform we're building and use it to set automatic platform ARGs:

        // Build platform ARGs.
        args["BUILDPLATFORM"] = buildPlatform.description
        args["BUILDOS"] = buildPlatform.os
        args["BUILDARCH"] = buildPlatform.architecture
        args["BUILDVARIANT"] = buildPlatform.variant ?? ""
        
        // Target platform ARGs.
        args["TARGETPLATFORM"] = targetPlatform.description
        args["TARGETOS"] = targetPlatform.os
        args["TARGETARCH"] = targetPlatform.architecture
        args["TARGETVARIANT"] = targetPlatform.variant ?? ""

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

dkovba avatar Aug 19 '25 05:08 dkovba

Not sure what this issue is tracking but I discovered today that these variables are available already in container ["CLI version 0.9.0 (build: release, commit: 3e49dce)"]. However they must be specified via ARG first. E.g.

FROM docker.io/alpine:3
RUN env && exit 1

does not reveal any build info, but

FROM docker.io/alpine:3
ARG TARGETARCH
RUN env && exit 1

Does show the TARGETARCH as being provided. This is consistent with Docker's own behavior as documented in https://docs.docker.com/reference/dockerfile/#automatic-platform-args-in-the-global-scope.

natevw avatar Mar 23 '26 22:03 natevw

Native builder work is not in our near term plan. Closing for now, but may reopen in the future when we're ready to work on native builder again.

katiewasnothere avatar Aug 05 '26 00:08 katiewasnothere