From 435128f0a47ce13fe5f2ff4f7d634d3c6cc3d4dd Mon Sep 17 00:00:00 2001 From: Haisam Ido Date: Tue, 5 Mar 2024 15:08:22 -0500 Subject: [PATCH] Updates to Makefile and docker-compose --- Makefile | 54 +++++++++++++++++++++++++++++++++------------- docker-compose.yml | 2 +- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index b3a664db50e..ad17122aa55 100644 --- a/Makefile +++ b/Makefile @@ -4,34 +4,58 @@ # Purpose: # Makefile that allows one to docker build, install openmct and start openmct # -# Author of this Makefile: -# Haisam Ido -# # Dependencies: # make, docker, docker-compose #------------------------------------------------------------------------------ +.PHONY: + +export SHELL :=/bin/bash +export UNAME :=$(shell uname) +export OS =Linux + +ifeq ($(UNAME), Darwin) +export OS=Darwin +endif + +export DIFF_PROGRAM:=vimdiff + +export CONTAINER_BIN =docker +export CONTAINER_COMPOSE =docker-compose + openmct-install: ## Install openmct on a docker image. This uses ./Dockerfile - docker build -t openmct:latest . + $(CONTAINER_BIN) build -t openmct:latest . -openmct-up: openmct-install openmct-down ## Start openmct in docker container, in a detached state. This uses ./docker-compose.yml - docker-compose up -d --remove-orphans +openmct-start: openmct-install openmct-stop ## Start openmct in docker container, in a detached state. This uses ./docker-compose.yml + $(CONTAINER_COMPOSE) up -d --remove-orphans @echo @echo "Connect via http://localhost:8080" @echo -openmct-down: ## Stop openmct on docker conainter - docker-compose down -v --remove-orphans +openmct-stop: ## Stop openmct on docker conainter + $(CONTAINER_COMPOSE) down -v --remove-orphans openmct-shell: ## Shell into running container - docker exec -it openmct_openmct_1 bash + $(CONTAINER_BIN) exec -it openmct_openmct_1 bash + +print-%: ## print a variable and its value, e.g. print the value of variable PROVIDER: make print-PROVIDER + @echo $* = $($*) + +define print-help +$(call print-target-header,"Makefile Help") + echo + printf "%s\n" "Illustrates how to use IaC tools by example. It will be different in operations" + echo +$(call print-target-header,"target description") + grep -E '^([a-zA-Z_-]).+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS=":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | grep $(or $1,".*") + echo +endef help: - @printf "\033[37m%-30s\033[0m %s\n" "#----------------------------------------------------------------------------------" - @printf "\033[37m%-30s\033[0m %s\n" "# Makefile targets |" - @printf "\033[37m%-30s\033[0m %s\n" "#----------------------------------------------------------------------------------" - @printf "\033[37m%-30s\033[0m %s\n" "#-target-----------------------description-----------------------------------------" - @grep -E '^[a-zA-Z_-].+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + @$(call print-help) + +help-%: ## Filtered help, e.g.: make help-terraform + @$(call print-help,$*) print-%: - @echo $* = $($*) \ No newline at end of file + @echo $*=$($*) diff --git a/docker-compose.yml b/docker-compose.yml index 92ff72b874f..41a29ddb6b6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3.8' services: openmct: image: "openmct:latest"