# Copyright 3000 Test Tester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# 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\
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/tester_workflow/Makefile ui-req

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

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

build: ui-build image-build

clean:
	make -f projects/tester_workflow/Makefile clean

purge:
	make -f projects/tester_workflow/Makefile purge
