-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
65 lines (54 loc) · 1.77 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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) [APT_PROXY|APT_PROXY_SSL=ip:port]"
echo
build:
docker build \
--build-arg APT_PROXY=$(APT_PROXY) \
--build-arg APT_PROXY_SSL=$(APT_PROXY_SSL) \
--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 ||:
start:
docker run --detach --interactive --tty \
--name $(NAME) \
--hostname $(NAME) \
--env "INIT_DEBUG=true" \
--publish 8080:8080 \
--publish 8443:8443 \
$(IMAGE)
stop:
docker stop $(NAME) > /dev/null 2>&1 ||:
docker rm $(NAME) > /dev/null 2>&1 ||:
log:
docker logs --follow $(NAME)
test:
docker run --detach --interactive --tty --name nginx codeworksio/nginx
sleep 10
docker ps | grep "nginx"
bash:
docker exec --interactive --tty \
--user root \
$(NAME) \
/bin/bash --login ||:
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)/hyhx4BgIQKqWR4IE4d7zUVJam0Q="
.SILENT: