-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
86 lines (76 loc) · 2.44 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
75
76
77
78
79
80
81
82
83
84
85
86
#!ash # Explicitly specify ash shell
PARENT_DIR := /root/registry-docker/
CHILD_DIR := /root/registry-docker/docker/
## start: Start registry container
start:
clear && . $(PARENT_DIR)ascii.sh "Registry"; \
cd $(CHILD_DIR); \
chmod 666 /var/run/docker.sock; \
docker-compose pull && docker compose up -d; \
cd $(PARENT_DIR) || exit 1
## restart: Restart registry container
restart:
clear && . $(PARENT_DIR)ascii.sh "Registry"; \
cd $(CHILD_DIR); \
chmod 666 /var/run/docker.sock; \
docker-compose down && docker compose up -d; \
cd $(PARENT_DIR) || exit 1
## stop: Stop registry container
stop:
clear && . $(PARENT_DIR)ascii.sh "Registry"; \
cd $(CHILD_DIR); \
docker-compose stop; \
cd $(PARENT_DIR) || exit 1
## logs: Tail registry container logs
logs:
clear && . $(PARENT_DIR)ascii.sh "Registry"; \
cd $(CHILD_DIR); \
docker-compose logs -f; \
cd $(PARENT_DIR) || exit 1
## show: Show registry containers
show:
clear && . $(PARENT_DIR)ascii.sh "Registry"; \
cd $(CHILD_DIR); \
docker-compose ps; \
cd $(PARENT_DIR) || exit 1
## list-images: List registry images
list-images:
clear && . $(PARENT_DIR)ascii.sh "Registry"; \
cd $(CHILD_DIR); \
curl -s http://localhost:5000/v2/_catalog | jq '.repositories[]'; \
cd $(PARENT_DIR) || exit 1
## create-dirs: Create registry required data folders
create-dirs:
clear && . $(PARENT_DIR)ascii.sh "Registry"; \
cd $(CHILD_DIR); \
rm -rf /root/registry; \
mkdir /root/registry; \
chmod -R 777 /root/registry; \
echo; \
echo "All Done!"; \
ls -al /root/registry; \
cd $(PARENT_DIR) || exit 1
## clean: Clean registry containers and volumes (using implicit rule)
.PHONY: clean
clean:
clear && . $(PARENT_DIR)ascii.sh "Registry"; \
cd $(CHILD_DIR); \
docker system prune -f; \
docker volume prune -f; \
cd $(PARENT_DIR) || exit 1
## help: Command to view help
help: Makefile
clear && . $(PARENT_DIR)ascii.sh "Registry"
@echo
@echo "Choose a command (Alpine Linux ONLY):"
@echo
@echo " start : Start registry container"
@echo " restart : Restart registry container"
@echo " stop : Stop registry container"
@echo " logs : Tail registry container logs"
@echo " show : Show registry containers"
@echo " list-images : List registry images received"
@echo " clean : Clean registry containers and volumes"
@echo " create-dirs : Create registry required data folders"
@echo " help : Show this help message"
@echo