Skip to content

Commit 413800b

Browse files
authored
Merge pull request #22554 from BenTheElder/auto-version
automatically tag docker image based on hugo version and dockerfile v…
2 parents 98fbbed + 7d62be1 commit 413800b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ NETLIFY_FUNC = $(NODE_BIN)/netlify-lambda
66
# but this can be overridden when calling make, e.g.
77
# CONTAINER_ENGINE=podman make container-image
88
CONTAINER_ENGINE ?= docker
9-
CONTAINER_IMAGE = kubernetes-hugo
9+
IMAGE_VERSION=$(shell scripts/hash-files.sh Dockerfile Makefile | cut -c 1-12)
10+
CONTAINER_IMAGE = kubernetes-hugo:v$(HUGO_VERSION)-$(IMAGE_VERSION)
1011
CONTAINER_RUN = $(CONTAINER_ENGINE) run --rm --interactive --tty --volume $(CURDIR):/src
1112

1213
CCRED=\033[0;31m

scripts/hash-files.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
# this script emits as hash for the files listed in $@
3+
if command -v shasum >/dev/null 2>&1; then
4+
cat "$@" | shasum -a 256 | cut -d' ' -f1
5+
elif command -v sha256sum >/dev/null 2>&1; then
6+
cat "$@" | sha256sum | cut -d' ' -f1
7+
else
8+
echo "missing shasum tool" 1>&2
9+
exit 1
10+
fi

0 commit comments

Comments
 (0)