-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
120 lines (83 loc) · 2.21 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
APP = srv-config
VERSION = 1.0.0
JAR = ${APP}-${VERSION}.jar
TARGET_JAR = target/${JAR}
DOCKER_IMAGE = ${APP}:latest
DOCKER_FOLDER = src/main/docker
DOCKER_CONF = ${DOCKER_FOLDER}/Dockerfile
COMPOSE_CONF = ${DOCKER_FOLDER}/docker-compose.yml
STACK_CONF = ${DOCKER_FOLDER}/docker-stack.yml
REPLICAS = 1
# Maven
clean:
./mvnw clean
all: clean
./mvnw compile
install: clean
./mvnw install
check: clean
./mvnw verify
check-unit: clean
./mvnw test
check-integration: clean
./mvnw integration-test
dist: clean
./mvnw package -Dmaven.test.skip=true
dist-run: dist run
run:
java ${JAVA_OPTS} -jar ${TARGET_JAR}
# Docker
dist-docker-build: dist docker-build
dist-docker-build-push: dist docker-build docker-push
docker-build-push: docker-build docker-push
docker-build:
DOCKER_BUILDKIT=1 docker build -f ${DOCKER_CONF} -t ${DOCKER_IMAGE} --build-arg=JAR_FILE=${JAR} target
docker-run:
docker run -d \
--restart=always \
--net schambeck-bridge \
--name ${APP} \
--env DISCOVERY_URI=http://srv-discovery:8761/eureka \
--env EUREKA_INSTANCE_PREFER_IP_ADDRESS=true \
--env SPRING_RABBITMQ_HOST=rabbitmq \
--env SPRING_RABBITMQ_PORT=5672 \
--env SPRING_RABBITMQ_VIRTUAL_HOST= \
--env SPRING_RABBITMQ_USERNAME=guest \
--env SPRING_RABBITMQ_PASSWORD=guest \
--publish 8888:8888 \
${DOCKER_IMAGE}
--rm-docker-image:
docker rmi ${DOCKER_IMAGE}
docker-bash:
docker exec -it docker_web_1 /bin/bash
docker-tag:
docker tag ${APP} ${DOCKER_IMAGE}
docker-push:
docker push ${DOCKER_IMAGE}
docker-pull:
docker pull ${DOCKER_IMAGE}
docker-stop-all-containers:
docker kill $$(docker ps -q)
docker-rm-all-containers:
docker container prune
docker-rm-all-images:
docker rmi -f $$(docker images -aq)
docker-logs:
docker logs ${APP} -f
# Compose
dist-compose-up: dist compose-up
compose-up:
docker-compose -p ${APP} -f ${COMPOSE_CONF} up -d --build
compose-down: --compose-down
compose-down-rmi: --compose-down --rm-docker-image
--compose-down:
docker-compose -f ${COMPOSE_CONF} down
compose-logs:
docker-compose -f ${COMPOSE_CONF} logs -f \web
# Swarm
stack-deploy:
docker stack deploy -c ${STACK_CONF} --with-registry-auth ${APP}
stack-rm:
docker stack rm ${APP}
service-logs:
docker service logs ${APP}_web -f