-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (35 loc) · 1.4 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
PROJECT_NAME?=evse
NAME:=charging-stations-simulator
SUBMODULES_INIT?=false
DOCKER_ECR_ACCOUNT_ID?=166296450311
DOCKER_ECR_REGION?=eu-west-3
DOCKER_ECR_REGISTRY_NAME?=charging_stations_simulator
DOCKER_ECR_TAG?=latest
.PHONY: all
default: all
submodule-update:
git submodule update --init --recursive
submodules-init=
ifeq '$(SUBMODULES_INIT)' 'true'
submodules-init += submodule-update
endif
$(NAME): $(submodules-init)
docker-compose -p $(PROJECT_NAME) up -d
$(NAME)-force: $(submodules-init)
docker-compose -p $(PROJECT_NAME) up -d --build --force-recreate
all: $(NAME)
clean-images:
-docker rmi $(PROJECT_NAME)_$(NAME)
clean-containers:
-docker-compose -p $(PROJECT_NAME) down
clean: clean-containers clean-images
docker-tag-ecr:
docker tag $(PROJECT_NAME)_$(NAME) $(DOCKER_ECR_ACCOUNT_ID).dkr.ecr.$(DOCKER_ECR_REGION).amazonaws.com/$(DOCKER_ECR_REGISTRY_NAME):$(DOCKER_ECR_TAG)
docker-push-ecr: $(NAME)-force 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/$(DOCKER_ECR_REGISTRY_NAME)
docker push $(DOCKER_ECR_ACCOUNT_ID).dkr.ecr.$(DOCKER_ECR_REGION).amazonaws.com/$(DOCKER_ECR_REGISTRY_NAME):$(DOCKER_ECR_TAG)
dist-clean-images:
docker image prune -a -f
dist-clean-volumes:
docker volume prune -f
dist-clean: clean-containers dist-clean-volumes dist-clean-images