add docker-image-tag target to Makefile
This commit is contained in:
parent
ffef611295
commit
9ed2663b6e
6
Makefile
6
Makefile
|
@ -72,7 +72,11 @@ statusgo-library: ##@cross-compile Build status-go as static library for current
|
|||
|
||||
docker-image: ##@docker Build docker image (use DOCKER_IMAGE_NAME to set the image name)
|
||||
@echo "Building docker image..."
|
||||
docker build --file _assets/build/Dockerfile --build-arg "build_tags=$(BUILD_TAGS)" . -t $(DOCKER_IMAGE_NAME)
|
||||
docker build --file _assets/build/Dockerfile --build-arg "build_tags=$(BUILD_TAGS)" . -t $(DOCKER_IMAGE_NAME):latest
|
||||
|
||||
docker-image-tag: ##@docker Tag DOCKER_IMAGE_NAME:latest with a tag following pattern $GIT_SHA[:8]-$BUILD_TAGS
|
||||
@echo "Tagging docker image..."
|
||||
docker tag $(DOCKER_IMAGE_NAME):latest $(DOCKER_IMAGE_NAME):$(shell BUILD_TAGS="$(BUILD_TAGS)" ./_assets/ci/get-docker-image-tag.sh)
|
||||
|
||||
xgo-docker-images: ##@docker Build xgo docker images
|
||||
@echo "Building xgo docker images..."
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Description
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
tag="$(git rev-parse HEAD | cut -c 1-8)"
|
||||
|
||||
if [ ! -z "$BUILD_TAGS" ]; then
|
||||
tag="$tag-$(echo $BUILD_TAGS | sed -e "s/[[:space:]]/-/g")"
|
||||
fi
|
||||
|
||||
echo $tag
|
Loading…
Reference in New Issue