-
Notifications
You must be signed in to change notification settings - Fork 62
/
Makefile
92 lines (67 loc) · 2.88 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
PROJECT_NAME?=evse
NAME:=emobility-smart-charging
DOCKER_USER?=
DOCKER_PASSWORD?=
DOCKER_PORT?=8080
DOCKER_TAG?=latest
DOCKER_ECR_ACCOUNT_ID?=
DOCKER_ECR_REGION?=eu-west-3
.PHONY: $(NAME)-docker-start
default: $(NAME)-docker-start
$(NAME)-build:
mvn clean install -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
$(NAME)-npm-install-frontend:
cd frontend && npm install
$(NAME)-build-frontend: $(NAME)-npm-install-frontend
mvn typescript-generator:generate
cd frontend && npm run build:prod:playground
$(NAME)-build-only-frontend:
cd frontend && npm run build:prod:playground
$(NAME)-start: $(NAME)-build
java -jar target/$(NAME)-0.0.1-SNAPSHOT.jar
$(NAME)-docker-build:
docker build -t $(PROJECT_NAME)_$(NAME) .
$(NAME)-docker-start: $(NAME)-docker-build
docker run -d -p $(DOCKER_PORT):8080 $(PROJECT_NAME)_$(NAME)
clean-$(NAME)-image:
-docker rmi $(PROJECT_NAME)_$(NAME)
clean-maven-image:
-docker rmi maven:alpine
clean-node-image:
-docker rmi node:lts-alpine
clean-tomcat-image:
-docker rmi tomcat:latest
clean-images clean-$(NAME)-images: clean-maven-image clean-node-image clean-tomcat-image clean-$(NAME)-image
clean-$(NAME)-containers:
-docker ps -a | awk '{ print $$1,$$2 }' | grep $(PROJECT_NAME)_$(NAME) | awk '{print $$1 }' | xargs -I {} docker rm --force {}
clean clean-$(NAME): clean-$(NAME)-containers clean-$(NAME)-images
$(NAME)-docker-tag:
docker tag $(PROJECT_NAME)_$(NAME) $(DOCKER_USER)/$(PROJECT_NAME)_$(NAME):$(DOCKER_TAG)
$(NAME)-docker-push: $(NAME)-docker-build $(NAME)-docker-tag
docker push $(DOCKER_USER)/$(PROJECT_NAME)_$(NAME):$(DOCKER_TAG)
$(NAME)-docker-tag-ecr:
docker tag $(PROJECT_NAME)_$(NAME) $(DOCKER_ECR_ACCOUNT_ID).dkr.ecr.$(DOCKER_ECR_REGION).amazonaws.com/$(NAME):$(DOCKER_TAG)
$(NAME)-docker-push-ecr: $(NAME)-docker-build $(NAME)-docker-tag-ecr
aws ecr get-login-password --region $(DOCKER_ECR_REGION) | docker login --username AWS --password-stdin $(DOCKER_ECR_ACCOUNT_ID).dkr.ecr.$(DOCKER_ECR_REGION).amazonaws.com/$(NAME)
docker push $(DOCKER_ECR_ACCOUNT_ID).dkr.ecr.$(DOCKER_ECR_REGION).amazonaws.com/$(NAME):$(DOCKER_TAG)
ifeq ($(OS),Windows_NT)
# FIXME
# $(NAME)-cf-push: set CF_DOCKER_PASSWORD=$(DOCKER_PASSWORD)
else
$(NAME)-cf-push: export CF_DOCKER_PASSWORD=$(DOCKER_PASSWORD)
endif
$(NAME)-cf-push: $(NAME)-docker-push
cf push --docker-image $(DOCKER_USER)/$(PROJECT_NAME)_$(NAME):$(DOCKER_TAG) --docker-username $(DOCKER_USER)
ifeq ($(OS),Windows_NT)
# FIXME
# $(NAME)-cf-push-only: set CF_DOCKER_PASSWORD=$(DOCKER_PASSWORD)
else
$(NAME)-cf-push-only: export CF_DOCKER_PASSWORD=$(DOCKER_PASSWORD)
endif
$(NAME)-cf-push-only:
cf push --docker-image $(DOCKER_USER)/$(PROJECT_NAME)_$(NAME):$(DOCKER_TAG) --docker-username $(DOCKER_USER)
dist-clean-images:
docker image prune -a -f
dist-clean-volumes:
docker volume prune -f
dist-clean: clean-$(NAME)-containers dist-clean-volumes dist-clean-images