forked from t0mer/uptimekuma-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (40 loc) · 1.6 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
66
67
68
69
70
71
72
73
74
REGISTRY_HOST=docker.io
USERNAME=ripl
#NAME=$(shell basename $(CURDIR))
NAME=uptimekuma-push-agent
IMAGE=$(USERNAME)/$(NAME)
.PHONY: pre-build docker-build build release \
push cleanup up down pull remove update
#all:
up: ## bring up the container
docker-compose -p $(NAME) up -d
down: ## bring down the container
docker-compose -p $(NAME) down
pull: ## pull the latest image from dockerhub
docker pull $(IMAGE)
remove:
# Trying to remove uptimekuma-push-agent will throw an error if it doesn't exist
@if [ "$(docker ps -f name=$(NAME) | grep -w $(NAME))" ]; then\
docker rm $(NAME);\
else \
echo "No container matching $(NAME) was found";\
fi
update: pull down remove up ## Update the docker image
# The targets below are relevant to building and pushing the image
build: pre-build docker-build ## builds a new version of the container image(s)
post-build:
pre-push:
post-push:
docker-build:
# Build latest with multiple tags
docker buildx build --platform linux/arm64/v8,linux/amd64 --tag $(IMAGE) -f Dockerfile .
release: build push ## builds a new version of your container image(s), and pushes it/them to the registry
push: pre-push do-push post-push ## pushes the images to dockerhub
do-push:
# Push latest
docker buildx build --platform linux/arm64/v8,linux/amd64 --push --tag $(IMAGE) -f Dockerfile .
cleanup: ## Remove images pulled/generated as part of the build process
docker rmi $(IMAGE)
# Shows help
help: ## show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | grep -v fgrep | sed -e 's/\([^:]*\):[^#]*##\(.*\)/printf '"'%-20s - %s\\\\n' '\1' '\2'"'/' |bash