forked from elasticdog/tiddlywiki-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (36 loc) · 1.51 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
DOCKER_HUB_REPOSITORY ?= jdharms
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
.PHONY: build
build: SOURCE_COMMIT = $(shell git rev-parse HEAD)
build:
docker build --build-arg "SOURCE_COMMIT=${SOURCE_COMMIT}" --tag tiddlywiki .
.PHONY: test
test:
cd tests/ && dgoss run tiddlywiki --listen
.PHONY: tag
tag:
# unique tag
docker tag tiddlywiki "${DOCKER_HUB_REPOSITORY}/tiddlywiki:${UNIQUE_TAG}"
# stable tags
docker tag tiddlywiki "${DOCKER_HUB_REPOSITORY}/tiddlywiki:latest"
docker tag tiddlywiki "${DOCKER_HUB_REPOSITORY}/tiddlywiki:${PATCH_VERSION}"
docker tag tiddlywiki "${DOCKER_HUB_REPOSITORY}/tiddlywiki:${MINOR_VERSION}"
docker tag tiddlywiki "${DOCKER_HUB_REPOSITORY}/tiddlywiki:${MAJOR_VERSION}"
docker image ls "${DOCKER_HUB_REPOSITORY}/tiddlywiki"
.PHONY: deploy
deploy: tag
# 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:
docker image rm tiddlywiki