-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
makefile
74 lines (62 loc) · 1.55 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
include .env
.PHONY: build up up_build down clean
.DEFAULT_GOAL:= up
build:
docker-compose build
up:
docker-compose up -d
up_build:
docker-compose down
docker-compose up --build -d
down:
docker-compose down
clean:
docker rmi $(docker images -f "dangling=true" -q)
build_api:
docker build -t cdn-golang .
run_api: build_api create_volume create_network
docker run -d \
--restart=always \
--name cdn-golang \
--log-driver none \
--network=$(APP_NAME) \
--env-file .env \
-p $(APP_PORT):$(APP_PORT) \
cdn-golang
run_minio: create_network
docker run -d \
-p 9000:9000 \
-p 9001:9001 \
--name cdn-minio \
--restart always \
--network=$(APP_NAME) \
--volume=minio:/var/lib/minio \
-e MINIO_ROOT_USER='$(MINIO_ROOT_USER)' \
-e MINIO_ROOT_PASSWORD='$(MINIO_ROOT_PASSWORD)' \
minio/minio server --console-address ":9001" /var/lib/minio
create_network:
@if ! docker network inspect $(APP_NAME) >/dev/null 2>&1; then \
docker network create $(APP_NAME); \
else \
echo "Network '$(APP_NAME)' already exists, using existing network."; \
fi
create_volume:
@if ! docker volume inspect $(APP_NAME) >/dev/null 2>&1; then \
docker volume create $(APP_NAME); \
else \
echo "Volume '$(APP_NAME)' already exists, skipping creation."; \
fi
redis-cli:
docker exec -it cdn-redis redis-cli
redis-logs:
docker logs -f cdn-redis
redis-restart:
docker restart cdn-redis
redis-clear:
docker exec cdn-redis redis-cli FLUSHALL
cdn-exec:
docker exec -it cdn-golang bash
cdn-logs:
docker logs -f cdn-golang
cdn-restart:
docker restart cdn-golang