| 1 | PROJECT_NAME?=evse |
| 2 | NAME:=e-mobility-charging-stations-simulator |
| 3 | SUBMODULES_INIT?=false |
| 4 | DOCKER_ECR_ACCOUNT_ID?=166296450311 |
| 5 | DOCKER_ECR_REGION?=eu-west-3 |
| 6 | DOCKER_ECR_REGISTRY_NAME?=e-mobility-charging-stations-simulator |
| 7 | DOCKER_ECR_TAG?=latest |
| 8 | |
| 9 | .PHONY: all |
| 10 | |
| 11 | default: all |
| 12 | |
| 13 | submodule-update: |
| 14 | git submodule update --init --recursive |
| 15 | |
| 16 | submodules-init= |
| 17 | ifeq '$(SUBMODULES_INIT)' 'true' |
| 18 | submodules-init += submodule-update |
| 19 | endif |
| 20 | |
| 21 | $(NAME): $(submodules-init) |
| 22 | docker-compose -p $(PROJECT_NAME) up -d |
| 23 | |
| 24 | $(NAME)-force: $(submodules-init) |
| 25 | docker-compose -p $(PROJECT_NAME) up -d --build --force-recreate |
| 26 | |
| 27 | all: $(NAME) |
| 28 | |
| 29 | clean-images: |
| 30 | -docker rmi $(PROJECT_NAME)-$(NAME) |
| 31 | |
| 32 | clean-containers: |
| 33 | -docker-compose -p $(PROJECT_NAME) down |
| 34 | |
| 35 | clean: clean-containers clean-images |
| 36 | |
| 37 | docker-tag-ecr: |
| 38 | docker tag $(PROJECT_NAME)-$(NAME) $(DOCKER_ECR_ACCOUNT_ID).dkr.ecr.$(DOCKER_ECR_REGION).amazonaws.com/$(DOCKER_ECR_REGISTRY_NAME):$(DOCKER_ECR_TAG) |
| 39 | |
| 40 | docker-push-ecr: $(NAME)-force docker-tag-ecr |
| 41 | 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) |
| 42 | docker push $(DOCKER_ECR_ACCOUNT_ID).dkr.ecr.$(DOCKER_ECR_REGION).amazonaws.com/$(DOCKER_ECR_REGISTRY_NAME):$(DOCKER_ECR_TAG) |
| 43 | |
| 44 | dist-clean-images: |
| 45 | docker image prune -a -f |
| 46 | |
| 47 | dist-clean-volumes: |
| 48 | docker volume prune -f |
| 49 | |
| 50 | dist-clean: clean-containers dist-clean-volumes dist-clean-images |