Add DOCKER_BUILDX to inject path of buildx binary
Signed-off-by: Davanum Srinivas <davanum@gmail.com>pull/38285/head
parent
55c54a6878
commit
04708a1a83
15
Makefile
15
Makefile
|
@ -14,6 +14,9 @@ CONTAINER_RUN = "$(CONTAINER_ENGINE)" run --rm --interactive --tty --volume
|
|||
CCRED=\033[0;31m
|
||||
CCEND=\033[0m
|
||||
|
||||
# Docker buildx related settings for multi-arch images
|
||||
DOCKER_BUILDX ?= docker buildx
|
||||
|
||||
.PHONY: all build build-preview help serve
|
||||
|
||||
help: ## Show this help.
|
||||
|
@ -78,17 +81,17 @@ PLATFORMS ?= linux/arm64,linux/amd64
|
|||
docker-push: ## Build a multi-architecture image and push that into the registry
|
||||
docker run --rm --privileged tonistiigi/binfmt:qemu-v6.2.0-26@sha256:5bf63a53ad6222538112b5ced0f1afb8509132773ea6dd3991a197464962854e --install all
|
||||
docker version
|
||||
docker buildx version
|
||||
docker buildx create --use --name=image-builder 2>/dev/null || docker buildx use --default image-builder
|
||||
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
|
||||
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
|
||||
docker buildx build \
|
||||
$(DOCKER_BUILDX) version
|
||||
$(DOCKER_BUILDX) inspect image-builder > /dev/null 2>&1 || $(DOCKER_BUILDX) create --name image-builder --use
|
||||
# copy existing Dockerfile and insert --platform=${TARGETPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
|
||||
sed -e 's/\(^FROM\)/FROM --platform=\$$\{TARGETPLATFORM\}/' Dockerfile > Dockerfile.cross
|
||||
$(DOCKER_BUILDX) build \
|
||||
--push \
|
||||
--platform=$(PLATFORMS) \
|
||||
--build-arg HUGO_VERSION=$(HUGO_VERSION) \
|
||||
--tag $(CONTAINER_IMAGE) \
|
||||
-f Dockerfile.cross .
|
||||
docker buildx stop image-builder
|
||||
$(DOCKER_BUILDX) stop image-builder
|
||||
rm Dockerfile.cross
|
||||
|
||||
container-build: module-check
|
||||
|
|
|
@ -20,7 +20,8 @@ steps:
|
|||
- -c
|
||||
- |
|
||||
gcloud auth configure-docker \
|
||||
&& make container-push
|
||||
&& apk add sed \
|
||||
&& make docker-push
|
||||
substitutions:
|
||||
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
|
||||
# can be used as a substitution
|
||||
|
|
Loading…
Reference in New Issue