-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
63 lines (47 loc) · 1.71 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
OWNER := fabianlee
PROJECT := tiny-tools-with-swaks
VERSION := 3.12.001
OPV := $(OWNER)/$(PROJECT):$(VERSION)
# you may need to change to "sudo docker" if not a member of 'docker' group
# add user to docker group: sudo usermod -aG docker $USER
DOCKERCMD := "docker"
BUILD_TIME := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
# unique id from last git commit
MY_GITREF := $(shell git rev-parse --short HEAD)
## builds docker image
docker-build:
@echo MY_GITREF is $(MY_GITREF)
$(DOCKERCMD) build -f Dockerfile -t $(OPV) .
## cleans docker image
clean:
$(DOCKERCMD) image rm $(OPV) | true
## runs container in foreground, testing a couple of override values
docker-run-fg: docker-ntp-port-clear
$(DOCKERCMD) run -it --rm $(OPV)
## runs container in foreground, override entrypoint to use use shell
docker-debug:
$(DOCKERCMD) run -it --rm --entrypoint "/bin/sh" $(OPV)
## run container in background, override /etc/chrony/chrony.conf using volume (not mandatory)
docker-run-bg: docker-ntp-port-clear
$(DOCKERCMD) run -d --network host $(CAPS) -p $(EXPOSEDPORT) $(VOL_FLAG) --rm --name $(PROJECT) $(OPV)
## get into console of container running in background
docker-cli-bg:
$(DOCKERCMD) exec -it $(PROJECT) /bin/sh
## tails $(DOCKERCMD)logs
docker-logs:
$(DOCKERCMD) logs -f $(PROJECT)
## stops container running in background
docker-stop:
$(DOCKERCMD) stop $(PROJECT)
## pushes to $(DOCKERCMD)hub
docker-push:
$(DOCKERCMD) push $(OPV)
test:
./chrony_test.sh
## pushes to kubernetes cluster
k8s-apply:
sed 's/3.12.001/$(VERSION)/' k8s-tiny-tools-with-swaks.yaml | kubectl apply -f -
@echo ""
@echo "tiny-tools-with-swaks pod created in default ns has swaks utility"
k8s-delete:
kubectl delete -f k8s-tiny-tools-with-swaks.yaml