Skip to content

Commit

Permalink
Explicitly list the tags to push
Browse files Browse the repository at this point in the history
The default behavior in Docker 20.10 changed, so that `docker push`
will only push the `latest` tag rather than all tags. Upstream did add
an option flag to support the previous behavior (`--all-tags`), but
explicitly listing the desired tags is more understandable and ensures
backward compatibility.

See:
- docker/cli#2214
- https://www.docker.com/blog/introducing-docker-engine-20-10/
  • Loading branch information
elasticdog committed Feb 3, 2021
1 parent e5bd122 commit 8ab747d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
DOCKER_HUB_REPOSITORY ?= elasticdog

UNIQUE_TAG := $(shell printf '%s.%s' "$$(date +%Y%m%d)" "$${CIRCLE_BUILD_NUM:-$$(git rev-parse --short=12 HEAD)}")
PATCH_VERSION := $(shell docker run -it --rm tiddlywiki --version | sed 's/[^0-9.]*//g')
MINOR_VERSION := $(shell echo "${PATCH_VERSION}" | awk -F. '{ print $$1"."$$2 }')
MAJOR_VERSION := $(shell echo "${PATCH_VERSION}" | awk -F. '{ print $$1 }')

.PHONY: all
all: build

Expand All @@ -13,10 +18,6 @@ test:
cd tests/ && dgoss run tiddlywiki --listen

.PHONY: tag
tag: UNIQUE_TAG = $(shell printf '%s.%s' "$$(date +%Y%m%d)" "$${CIRCLE_BUILD_NUM:-$$(git rev-parse --short=12 HEAD)}")
tag: PATCH_VERSION = $(shell docker run -it --rm tiddlywiki --version | sed 's/[^0-9.]*//g')
tag: MINOR_VERSION = $(shell echo "${PATCH_VERSION}" | awk -F. '{ print $$1"."$$2 }')
tag: MAJOR_VERSION = $(shell echo "${PATCH_VERSION}" | awk -F. '{ print $$1 }')
tag:
# unique tag
docker tag tiddlywiki "${DOCKER_HUB_REPOSITORY}/tiddlywiki:${UNIQUE_TAG}"
Expand All @@ -29,7 +30,13 @@ tag:

.PHONY: deploy
deploy: tag
docker push "${DOCKER_HUB_REPOSITORY}/tiddlywiki"
# unique tag
docker push "${DOCKER_HUB_REPOSITORY}/tiddlywiki:${UNIQUE_TAG}"
# stable tags
docker push "${DOCKER_HUB_REPOSITORY}/tiddlywiki:latest"
docker push "${DOCKER_HUB_REPOSITORY}/tiddlywiki:${PATCH_VERSION}"
docker push "${DOCKER_HUB_REPOSITORY}/tiddlywiki:${MINOR_VERSION}"
docker push "${DOCKER_HUB_REPOSITORY}/tiddlywiki:${MAJOR_VERSION}"

.PHONY: clean
clean:
Expand Down

0 comments on commit 8ab747d

Please sign in to comment.