Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Makefile: auto-incrementing
IMAGE_NAME := whatever/whatever
.PHONY: docker-build version-increment bc-check
docker-build: version-increment
DOCKER_BUILDKIT=1 docker buildx build -t $(IMAGE_NAME):v$(shell cat version.txt) .
version-increment: bc-check
bc <<< "1 + $(shell cat version.txt)" > version.txt
@command -v bc >/dev/null 2>&1 || { echo >&2 "I require bc but it's not installed. Aborting."; exit 1; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment