Skip to content

Multi Platform Build pushes platforms linux/amd64 and linux/arm64 but both binaries are amd64 #668

@zioproto

Description

@zioproto

Behaviour

I am running a GitHub action exactly like the example provided:

My code:
https://github.com/zioproto/tfmod-scaffold/blob/debug/.github/workflows/debug.yaml

The example:
https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md

I am testing the produced image on a Mac M1pro with Docker Desktop

Steps to reproduce this issue

I stripped down my Dockerfile to the bare minimum.

https://github.com/zioproto/tfmod-scaffold/blob/debug/Dockerfile

When I test the container like this:

% docker run --platform=linux/arm64 --rm zioproto/debug:latest go version
Unable to find image 'zioproto/debug:latest' locally
latest: Pulling from zioproto/debug
d836772a1c1f: Already exists
66a9e63c657a: Already exists
d1989b6e74cf: Already exists
c28818711e1e: Already exists
98c059399382: Already exists
664eea083347: Already exists
b4cc10248836: Already exists
Digest: sha256:176743a658639afd7d62b6e4551e99bf0e67cf98add713867c9d77d5b19c03d8
Status: Downloaded newer image for zioproto/debug:latest
go version go1.19 linux/amd64

I always get golang for amd64 go version go1.19 linux/amd64

The base image I am using has proper support for arm64

% docker run --rm mcr.microsoft.com/oss/go/microsoft/golang:1.19 go version
go version go1.19 linux/arm64
% docker run --rm  --platform=linux/arm64 mcr.microsoft.com/oss/go/microsoft/golang:1.19 go version
go version go1.19 linux/arm64
% docker run --rm  --platform=linux/amd64 mcr.microsoft.com/oss/go/microsoft/golang:1.19 go version
Unable to find image 'mcr.microsoft.com/oss/go/microsoft/golang:1.19' locally
1.19: Pulling from oss/go/microsoft/golang
d836772a1c1f: Already exists
66a9e63c657a: Already exists
d1989b6e74cf: Already exists
c28818711e1e: Already exists
98c059399382: Already exists
664eea083347: Already exists
b4cc10248836: Already exists
Digest: sha256:df429a4c9d180b0feedfe2b71be356cd6aa2ef96b35e810e76d74d31577fec3d
Status: Downloaded newer image for mcr.microsoft.com/oss/go/microsoft/golang:1.19
go version go1.19 linux/amd64
% docker run --rm  --platform=linux/amd64 zioproto/debug go version
Unable to find image 'zioproto/debug:latest' locally
latest: Pulling from zioproto/debug
d836772a1c1f: Already exists
66a9e63c657a: Already exists
d1989b6e74cf: Already exists
c28818711e1e: Already exists
98c059399382: Already exists
664eea083347: Already exists
b4cc10248836: Already exists
Digest: sha256:176743a658639afd7d62b6e4551e99bf0e67cf98add713867c9d77d5b19c03d8
Status: Downloaded newer image for zioproto/debug:latest
go version go1.19 linux/amd64
% docker run --rm  --platform=linux/arm64 zioproto/debug go version
Unable to find image 'zioproto/debug:latest' locally
latest: Pulling from zioproto/debug
Digest: sha256:176743a658639afd7d62b6e4551e99bf0e67cf98add713867c9d77d5b19c03d8
Status: Downloaded newer image for zioproto/debug:latest
go version go1.19 linux/amd64

Expected behaviour

I expected the arm64 image to have a arm64 binary

Configuration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions