# Copyright 3000 Tester1
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# This file was generated by BlueCat Automation Toolkit (BATK).
# Portions which reproduce template contents from BATK are Copyright 2023 BlueCat Networks Inc.
# Other contents are owned by their authors.
BASE_DIR := $(shell pwd)
export BASE_DIR

default:
	@echo "\
Available targets:\n\
run-prep\n\
run\n\
stop\n\
ui-req\n\
ui-build\n\
image-build\n\
build\n\
clean\n\
purge"

run-prep:
	mkdir -p logs
	-[ ! -f workspace/config.json ] \
		&& cp workspace/config.json.sample workspace/config.json
	-[ ! -f workspace/permissions.json ] \
		&& cp workspace/permissions.json.sample workspace/permissions.json

run: run-prep
	docker run -it \
		-p 80:8000 \
		-p 443:44300 \
		-v "$(BASE_DIR)/workspace":/bluecat_gateway \
		-v "$(BASE_DIR)/logs":/logs \
	 	-u "$(shell id -u)" \
		--name custom-workflows \
		quay.io/bluecat/gateway:24.1.0

stop:
	docker stop custom-workflows

ui-req:
	make -f projects/test_name_1/Makefile ui-req

ui-build:
	make -f projects/test_name_1/Makefile ui-build

image-build:
	docker build --tag custom_workflows:latest .

build: ui-build image-build

clean:
	make -f projects/test_name_1/Makefile clean

purge:
	make -f projects/test_name_1/Makefile purge
