Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions docker/docker-hub-build-push-single-arg-multi-arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
SHELL := /bin/bash
DOCKER_REPO_NAME := binbash

# if more docker tags have to be passed, set a var as follows in your calle makefile:
# ADDITIONAL_TAGS := "tag1,tag2,tagn"
#
ifdef ADDITIONAL_TAGS
ADT := $(shell echo ${ADDITIONAL_TAGS}|tr ',' ' ')
ADDITIONAL_TAGS_INTERNAL := $(foreach arg, ${ADT}, -t${DOCKER_REPO_NAME}/${DOCKER_IMG_NAME}:$(arg))
else
ADDITIONAL_TAGS_INTERNAL :=
endif

# if a specific platform has to be targeted set in your called makefile this var setting your platforms as value:
# TARGET_PLATFORMS := 'linux/amd64,linux/arm64,linux/arm/v6'
#
Expand All @@ -21,7 +31,7 @@ ifdef ADDITIONAL_DOCKER_ARGS
ADA := $(shell echo ${ADDITIONAL_DOCKER_ARGS}|tr ',' ' ')
OTHER_DOCKER_ARGS := $(foreach arg, ${ADA}, --build-arg $(arg))
else
OTHER_DOCKER_ARGS := ''
OTHER_DOCKER_ARGS :=
endif

help:
Expand All @@ -39,15 +49,15 @@ runbuildxlocal:
docker buildx build \
--builder=container \
--load \
-t ${DOCKER_REPO_NAME}/${DOCKER_IMG_NAME}:${DOCKER_TAG} \
-t ${DOCKER_REPO_NAME}/${DOCKER_IMG_NAME}:${DOCKER_TAG} ${ADDITIONAL_TAGS_INTERNAL} \
--build-arg DOCKER_TAG='${DOCKER_TAG}'${OTHER_DOCKER_ARGS} .

runbuildxpush:
@docker buildx build \
--builder=container \
--platform ${TARGET_PLATFORMS_INTERNAL} \
--push \
-t ${DOCKER_REPO_NAME}/${DOCKER_IMG_NAME}:${DOCKER_TAG} \
-t ${DOCKER_REPO_NAME}/${DOCKER_IMG_NAME}:${DOCKER_TAG} ${ADDITIONAL_TAGS_INTERNAL} \
--build-arg DOCKER_TAG='${DOCKER_TAG}'${OTHER_DOCKER_ARGS} .

setbuildxenv:
Expand Down