Merge pull request #22554 from BenTheElder/auto-version

automatically tag docker image based on hugo version and dockerfile v…
pull/22557/head
Kubernetes Prow Robot 2020-07-26 20:52:16 -07:00 committed by GitHub
commit 413800b209
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -6,7 +6,8 @@ NETLIFY_FUNC = $(NODE_BIN)/netlify-lambda
# but this can be overridden when calling make, e.g.
# CONTAINER_ENGINE=podman make container-image
CONTAINER_ENGINE ?= docker
CONTAINER_IMAGE = kubernetes-hugo
IMAGE_VERSION=$(shell scripts/hash-files.sh Dockerfile Makefile | cut -c 1-12)
CONTAINER_IMAGE = kubernetes-hugo:v$(HUGO_VERSION)-$(IMAGE_VERSION)
CONTAINER_RUN = $(CONTAINER_ENGINE) run --rm --interactive --tty --volume $(CURDIR):/src
CCRED=\033[0;31m

10
scripts/hash-files.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# this script emits as hash for the files listed in $@
if command -v shasum >/dev/null 2>&1; then
cat "$@" | shasum -a 256 | cut -d' ' -f1
elif command -v sha256sum >/dev/null 2>&1; then
cat "$@" | sha256sum | cut -d' ' -f1
else
echo "missing shasum tool" 1>&2
exit 1
fi