2020-08-10 10:13:38 +00:00
|
|
|
ARG GO_VERSION=1.13.15
|
2021-01-26 10:37:50 +00:00
|
|
|
ARG BUILDX_COMMIT=v0.5.1
|
2019-06-07 17:10:31 +00:00
|
|
|
ARG BUILDX_REPO=https://github.com/docker/buildx.git
|
2019-10-14 12:51:49 +00:00
|
|
|
|
2020-06-24 12:31:04 +00:00
|
|
|
FROM golang:${GO_VERSION}-buster AS build
|
2019-10-14 12:51:49 +00:00
|
|
|
ARG BUILDX_REPO
|
2019-06-07 17:10:31 +00:00
|
|
|
RUN git clone "${BUILDX_REPO}" /buildx
|
|
|
|
WORKDIR /buildx
|
2019-10-14 12:51:49 +00:00
|
|
|
ARG BUILDX_COMMIT
|
2019-06-07 17:10:31 +00:00
|
|
|
RUN git fetch origin "${BUILDX_COMMIT}":build && git checkout build
|
|
|
|
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.
|
2019-10-14 11:34:28 +00:00
|
|
|
RUN GOOS="${GOOS}" GOARCH="${GOARCH}" BUILDX_COMMIT="${BUILDX_COMMIT}"; \
|
|
|
|
pkg="github.com/docker/buildx"; \
|
|
|
|
ldflags="\
|
|
|
|
-X \"${pkg}/version.Version=$(git describe --tags)\" \
|
|
|
|
-X \"${pkg}/version.Revision=$(git rev-parse --short HEAD)\" \
|
|
|
|
-X \"${pkg}/version.Package=buildx\" \
|
|
|
|
"; \
|
2020-05-02 16:53:17 +00:00
|
|
|
go build -mod=vendor -ldflags "${ldflags}" -o /usr/bin/buildx ./cmd/buildx
|
2019-10-14 13:27:52 +00:00
|
|
|
|
2020-06-24 12:31:04 +00:00
|
|
|
FROM golang:${GO_VERSION}-buster
|
2019-10-14 13:27:52 +00:00
|
|
|
COPY --from=build /usr/bin/buildx /usr/bin/buildx
|
2019-10-14 11:34:28 +00:00
|
|
|
ENTRYPOINT ["/usr/bin/buildx"]
|