Browse code

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>

Sebastiaan van Stijn authored on 2019/10/14 21:51:49
Showing 2 changed files
... ...
@@ -1,9 +1,12 @@
1 1
 ARG GO_VERSION=1.12.10
2
-FROM golang:${GO_VERSION}-stretch
2
+ARG BUILDX_COMMIT=v0.3.0
3 3
 ARG BUILDX_REPO=https://github.com/docker/buildx.git
4
+
5
+FROM golang:${GO_VERSION}-stretch
6
+ARG BUILDX_REPO
4 7
 RUN git clone "${BUILDX_REPO}" /buildx
5 8
 WORKDIR /buildx
6
-ARG BUILDX_COMMIT=master
9
+ARG BUILDX_COMMIT
7 10
 RUN git fetch origin "${BUILDX_COMMIT}":build && git checkout build
8 11
 RUN go mod download
9 12
 ARG GOOS
... ...
@@ -252,9 +252,6 @@ else
252 252
 buildx:
253 253
 endif
254 254
 
255
-BUILDX_COMMIT ?= v0.3.0
256
-export BUILDX_COMMIT
257
-
258 255
 bundles/buildx: BUILDX_DOCKERFILE ?= Dockerfile.buildx
259 256
 bundles/buildx: bundles ## build buildx CLI tool
260 257
 	# This intetionally is not using the `--output` flag from the docker CLI which is a buildkit option