Your IP : 216.73.216.14


Current Path : /home/deltalab/PMS/
Upload File :
Current File : //home/deltalab/PMS/Makefile

#
# This file is a template Makefile. Some targets are presented here as examples.
# Feel free to customize it to your needs!
#

BLACK=\033[0;30m
DARK_GREY=\033[1;30m
RED=\033[0;31m
LIGHT_RED=\033[1;31m
GREEN=\033[0;32m
LIGHT_GREEN=\033[1;32m
ORANGE=\033[0;33m
YELLOW=\033[1;33m
BLUE=\033[0;34m
LIGHT_BLUE=\033[1;34m
PURPLE=\033[0;35m
LIGHT_PURPLE=\033[1;35m
CYAN=\033[0;36m
LIGHT_CYAN=\033[1;36m
LIGHT_GRAY=\033[0;37m
WHITE=\033[1;37m
NC=\033[0m # No Color

.DEFAULT_GOAL := stage

.PHONY: stage
stage:
	@echo "\n==========\n${RED}Shutting down current running platform...${NC}\n"
	$(MAKE) down_stage
	@echo "\n==========\n${YELLOW}Rebuilding images...\n${NC}"
	$(MAKE) rebuild_images
	@echo "\n==========\n${BLUE}Launching platform...\n${NC}"
	$(MAKE) up
	@echo "${LIGHT_GREEN}\n==========\nStaging platform launched. Use make down_stage to correctly stop the platform\n==========\n${NC}"

.PHONY: prod
prod:
	@echo "\n==========\n${RED}Shutting down current running platform...${NC}\n"
	$(MAKE) down
	@echo "\n==========\n${YELLOW}Rebuilding images...\n${NC}"
	$(MAKE) rebuild_images
	@echo "\n==========\n${BLUE}Launching platform...\n${NC}"
	$(MAKE) up
	@echo "${LIGHT_GREEN}\n==========\n${LIGHT_GREEN}Production platform launched. Use make down to correctly stop the platform\n==========\n${NC}"

.PHONY: log
log:
	@echo "\n==========\n${RED}Shutting down current running platform...${NC}\n"
	$(MAKE) down
	@echo "\n==========\n${YELLOW}Rebuilding images...\n${NC}"
	$(MAKE) rebuild_images
	@echo "\n==========\n${BLUE}Launching platform with enabled logs...\n${NC}"
	$(MAKE) up_log


.PHONY: build
build:
	docker-compose build --no-cache
	docker image prune -f

.PHONY: rebuild_images
rebuild_images:
	docker image rm pms-be pms-fe pms-mongodb ims-conn sms-conn bubu-generator pim-conn
	docker image prune -f
	$(MAKE) build

.PHONY: up
up:
	docker container prune -f
	docker-compose up -d --remove-orphans

.PHONY: up_log
up_log:
	docker container prune -f
	docker-compose up --remove-orphans


.PHONY: down_stage
down_stage:
	docker-compose down -v

.PHONY: down
down:
	docker-compose down