-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (40 loc) · 1.28 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
# This should match the username used on your registry
USERNAME=moatorres
# You can rename this to whatever you want
PROJECT=infrago
# TAG will be filled by the output of next command
TAG=
# Set TAG to the shorter SHA256 version of the latest commit
$(eval TAG := $(shell git rev-parse --short HEAD))
#
# Docker
#
build:
docker buildx build -f Dockerfile . -t ghcr.io/${USERNAME}/${PROJECT}:$(value TAG)
docker buildx build -f Dockerfile . -t docker.io/${USERNAME}/${PROJECT}:$(value TAG)
push:
docker push docker.io/${USERNAME}/${PROJECT}:$(value TAG)
docker push ghcr.io/${USERNAME}/${PROJECT}:$(value TAG)
run:
docker run --name ${PROJECT} -it -d -p 3000:3000 ${USERNAME}/${PROJECT}:$(value TAG)
exec:
docker exec -t -i ${PROJECT} /bin/ash
explore:
docker run --rm -it --entrypoint=/bin/ash ${PROJECT}
stop:
docker stop ${PROJECT}
remove:
docker remove ${PROJECT}
#
# Kubernetes
#
DEV_MANIFESTS=$(wildcard k8s/dev/*.yaml)
deploy-dev:
for file in $(DEV_MANIFESTS); do kubectl apply -f $$file; done
cleanup-dev:
for file in $(DEV_MANIFESTS); do kubectl delete -f $$file; done
PRD_MANIFESTS=$(wildcard k8s/production/*.yaml)
deploy-prd:
for file in $(PRD_MANIFESTS); do kubectl apply -f $$file; done
cleanup-prd:
for file in $(PRD_MANIFESTS); do kubectl delete -f $$file; done