make buildx: make version in Dockerfile leading

This patch removes the `BUILDX_COMMIT` make variable. With the
make variable removed, it no longer "masks" environment variables,
and there is no longer a need to export the variable.

A side effect of this change, is that (by default), the buildx
image is tagged as `moby-buildx:latest`. This likely isn't a
problem, because the build-cache would still be preserved in
intermediate images. Having the image tagged as `:latest` also
makes cleaning up easier (without having to remove the image
for each version tagged.

Otherwise, the behavior remains the same as before:

    # default
    rm -f bundles/buildx && make buildx
    # => => naming to docker.io/library/moby-buildx:latest
    github.com/docker/buildx v0.3.0 c967f1d

    # using a make variable:
    rm -f bundles/buildx && make BUILDX_COMMIT=v0.2.1 buildx
    # => => naming to docker.io/library/moby-buildx:v0.2.1
    github.com/docker/buildx v0.2.1 0eb2df5

    # using an environment variable:
    rm -f bundles/buildx && BUILDX_COMMIT=v0.2.2 make buildx
    # => => naming to docker.io/library/moby-buildx:v0.2.2
    github.com/docker/buildx v0.2.2 ab5fe3d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-10-14 14:51:49 +02:00
parent 365b3aee2d
commit 37fe68f5d6
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 5 additions and 5 deletions

View File

@ -1,9 +1,12 @@
ARG GO_VERSION=1.12.10
FROM golang:${GO_VERSION}-stretch
ARG BUILDX_COMMIT=v0.3.0
ARG BUILDX_REPO=https://github.com/docker/buildx.git
FROM golang:${GO_VERSION}-stretch
ARG BUILDX_REPO
RUN git clone "${BUILDX_REPO}" /buildx
WORKDIR /buildx
ARG BUILDX_COMMIT=master
ARG BUILDX_COMMIT
RUN git fetch origin "${BUILDX_COMMIT}":build && git checkout build
RUN go mod download
ARG GOOS

View File

@ -252,9 +252,6 @@ else
buildx:
endif
BUILDX_COMMIT ?= v0.3.0
export BUILDX_COMMIT
bundles/buildx: BUILDX_DOCKERFILE ?= Dockerfile.buildx
bundles/buildx: bundles ## build buildx CLI tool
# This intetionally is not using the `--output` flag from the docker CLI which is a buildkit option