Makefile #1

  • //
  • guest/
  • perforce_software/
  • log-analyzer/
  • psla/
  • Makefile
  • View
  • Commits
  • Open Download .zip Download (1 KB)
# Simple Makefile to build and run Docker container for PSLA using log2sql.py

PORT=5000
APP_NAME=psla
APP_DIR=psla

# HELP
# This will output the help for each task
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help

help: ## This help.
	@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

.DEFAULT_GOAL := help

# DOCKER TASKS
# Build the container
build: ## Build the container
	docker build -t $(APP_NAME) $(APP_DIR)

build-nc: ## Build the container without caching
	docker build --no-cache -t $(APP_NAME) $(APP_DIR)

run: ## Run container on port
	# Create logs dir if it doesn't already exist so it can be mounted as a volume in the container
	mkdir -p $(APP_DIR)/logs
	docker run --rm -p=$(PORT):$(PORT) --name="$(APP_NAME)" -v `pwd`/$(APP_DIR)/logs:/logs $(APP_NAME)

up: build run ## Run container on port (Alias to run)

stop: ## Stop and remove a running container
	docker stop $(APP_NAME); docker rm $(APP_NAME)
# Change User Description Committed
#1 25216 Robert Cowham Branch files to Workshop mandated path for project
//guest/perforce_software/utils/log_analyzer/Makefile
#6 23771 Robert Cowham Error handling for queries - refactor and move to seperate file
#5 23768 Robert Cowham Tidy to make clear we use apps dir var
#4 23765 Robert Cowham Moved things down one level to psla dir to make it easier to see what belongs
#3 23723 Robert Cowham First basic chart with plotly
#2 23706 Robert Cowham Remove extraneous info from Makefile
#1 23704 Robert Cowham Save before simplifying