833444c0d6
Since the dockerfile now requires buildkit, let's just use buildx can bootstrap itself into even an old version of Docker which does not support buildkit. This also decouples the Dockerfile/build from the version of Docker which is installed. One major downside: If buildx needs to setup a container driver (ie, docker does not support buildkit), the `make shell` target (and others which call `DOCKER_RUN_DOCKER`) must export the image from buildkit and into docker. This added an extra 70s to a full build for me (agan only for targets which call `DOCKER_RUN_DOCKER`) and 40s on a rebuild (with no changes). Signed-off-by: Brian Goff <cpuguy83@gmail.com>
14 lines
No EOL
740 B
Text
14 lines
No EOL
740 B
Text
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"] |