-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (33 loc) · 1.23 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
TARGETS := $(shell cat $(realpath $(lastword $(MAKEFILE_LIST))) | grep "^[a-z]*:" | awk '{ print $$1; }' | sed 's/://g' | grep -vE 'all|help' | paste -sd "|" -)
NAME := $(subst docker-,,$(shell basename $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))))
IMAGE := codeworksio/$(NAME)
all: help
help:
echo
echo "Usage:"
echo
echo " make $(TARGETS)"
echo
build:
docker build \
--build-arg IMAGE=$(IMAGE) \
--build-arg BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \
--build-arg VERSION=$(shell cat VERSION) \
--build-arg VCS_REF=$(shell git rev-parse --short HEAD) \
--build-arg VCS_URL=$(shell git config --get remote.origin.url) \
--tag $(IMAGE):$(shell cat VERSION) \
--rm .
docker tag $(IMAGE):$(shell cat VERSION) $(IMAGE):latest
docker rmi --force $$(docker images | grep "<none>" | awk '{ print $$3 }') 2> /dev/null ||:
test:
docker run --interactive --tty --rm $(IMAGE) \
--version | grep "psql"
clean:
docker rmi $(IMAGE):$(shell cat VERSION) > /dev/null 2>&1 ||:
docker rmi $(IMAGE):latest > /dev/null 2>&1 ||:
push:
docker push $(IMAGE):$(shell cat VERSION)
docker push $(IMAGE):latest
sleep 10
curl --request POST "https://hooks.microbadger.com/images/$(IMAGE)/SpD-1RBB60rvWgkvamYrtKsGsQ4="
.SILENT: