ARG GO_VERSION=1.12.10 FROM golang:${GO_VERSION}-stretch ARG BUILDX_REPO=https://github.com/docker/buildx.git RUN git clone "${BUILDX_REPO}" /buildx WORKDIR /buildx ARG BUILDX_COMMIT=master RUN git fetch origin "${BUILDX_COMMIT}":build && git checkout build RUN go mod download ARG GOOS ARG GOARCH # Keep these essentially no-op var settings for debug purposes. # It allows us to see what the GOOS/GOARCH that's being built for is. RUN GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags '-X github.com/docker/buildx/version.Version=${BUILDX_COMMIT} -X github.com/docker/buildx/version.Revision=${BUILDX_COMMIT} -X github.com/docker/buildx/version.Package=github.com/docker/buildx' -o /usr/bin/buildx ./cmd/buildx ENTRYPOINT ["/usr/bin/buildx"]