lib/Makefile

160 lines
4.6 KiB
Makefile

TAXNEXUS_VERSION ?= 1.2.7
TAXNEXUS_REPO_NAME = rules
TAXNEXUS_BUILD_ENV ?= dev
TEST_IP = 10.8.0.205
TAXNEXUS_REGISTRY_PUB = docker.io
TAXNEXUS_REGISTRY_PRIV = hub.tnxs.net
.PHONY: build run upload swagger docs apex mysql
run:
docker run \
-v /etc/taxnexus:/etc/taxnexus \
--network=fabric-net \
--log-driver=gelf --log-opt gelf-address=udp://packrat.noc.tnxs.net:12201 \
--ip=$(TEST_IP) \
--publish $(TEST_PORT):8080/tcp \
taxnexus/$(TAXNEXUS_REPO_NAME)_$(TAXNEXUS_BUILD_ENV):latest
upload:
# docker push $(TAXNEXUS_REGISTRY_PUB)/taxnexus/$(TAXNEXUS_REPO_NAME)_$(TAXNEXUS_BUILD_ENV):$(TAXNEXUS_VERSION)
# docker push $(TAXNEXUS_REGISTRY_PUB)/taxnexus/$(TAXNEXUS_REPO_NAME)_$(TAXNEXUS_BUILD_ENV):latest
docker push $(TAXNEXUS_REGISTRY_PRIV)/taxnexus/$(TAXNEXUS_REPO_NAME)/$(TAXNEXUS_REPO_NAME)_$(TAXNEXUS_BUILD_ENV):$(TAXNEXUS_VERSION)
docker push $(TAXNEXUS_REGISTRY_PRIV)/taxnexus/$(TAXNEXUS_REPO_NAME)/$(TAXNEXUS_REPO_NAME)_$(TAXNEXUS_BUILD_ENV):latest
swagger:
#
# generate auth
#
rm -rf ./api
mkdir -p api/auth
swagger generate client \
--log-output=./swagger/logs/generate-auth-client.log \
--copyright-file=./build/COPYRIGHT \
--name=auth \
--spec=./swagger/auth-taxnexus.yaml \
--target=./api/auth \
--client-package=auth-client \
--model-package=auth-models \
--principal=app.User
#
# generate crm
#
mkdir api/crm
swagger generate client \
--log-output=./swagger/logs/generate-crm-client.log \
--copyright-file=./build/COPYRIGHT \
--name=crm \
--spec=./swagger/crm-taxnexus.yaml \
--target=./api/crm \
--client-package=crm-client \
--model-package=crm-models \
--principal=app.User
#
# generate devops
#
mkdir api/devops
swagger generate client \
--log-output=./swagger/logs/generate-devops-client.log \
--copyright-file=./build/COPYRIGHT \
--name=devops \
--spec=./swagger/devops-taxnexus.yaml \
--target=./api/devops \
--client-package=devops-client \
--model-package=devops-models \
--principal=app.User
#
# generate geo
#
mkdir api/geo
swagger generate client \
--log-output=./swagger/logs/generate-geo-client.log \
--copyright-file=./build/COPYRIGHT \
--name=geo \
--spec=./swagger/geo-taxnexus.yaml \
--target=./api/geo \
--client-package=geo-client \
--model-package=geo-models \
--principal=app.User
#
# generate ledger
#
mkdir api/ledger
swagger generate client \
--log-output=./swagger/logs/generate-ledger-client.log \
--copyright-file=./build/COPYRIGHT \
--name=ledger \
--spec=./swagger/ledger-taxnexus.yaml \
--target=./api/ledger \
--client-package=ledger-client \
--model-package=ledger-models \
--principal=app.User
#
# generate ops
#
mkdir api/ops
swagger generate client \
--log-output=./swagger/logs/generate-ops-client.log \
--copyright-file=./build/COPYRIGHT \
--name=ops \
--spec=./swagger/ops-taxnexus.yaml \
--target=./api/ops \
--client-package=ops-client \
--model-package=ops-models \
--principal=app.User
#
# generate regs
#
mkdir api/regs
swagger generate client \
--log-output=./swagger/logs/generate-regs-client.log \
--copyright-file=./build/COPYRIGHT \
--name=regs \
--spec=./swagger/regs-taxnexus.yaml \
--target=./api/regs \
--client-package=regs-client \
--model-package=regs-models \
--principal=app.User
#
# generate workflow
#
mkdir api/workflow
swagger generate client \
--log-output=./swagger/logs/generate-workflow-client.log \
--copyright-file=./build/COPYRIGHT \
--name=workflow \
--spec=./swagger/workflow-taxnexus.yaml \
--target=./api/workflow \
--client-package=workflow-client \
--model-package=workflow-models \
--principal=app.User
avro:
# generate avro stubs
#
rm -rf swagger/avro
mkdir swagger/avro
openapi-generator generate \
--generator-name avro-schema \
--input-spec ./swagger/rules-taxnexus.yaml \
--output ./swagger/avro \
build:
# docker build
go mod tidy
docker build \
--tag $(TAXNEXUS_REGISTRY_PUB)/taxnexus/$(TAXNEXUS_REPO_NAME)_$(TAXNEXUS_BUILD_ENV):$(TAXNEXUS_VERSION) \
--tag $(TAXNEXUS_REGISTRY_PUB)/taxnexus/$(TAXNEXUS_REPO_NAME)_$(TAXNEXUS_BUILD_ENV):latest \
--tag $(TAXNEXUS_REGISTRY_PRIV)/taxnexus/$(TAXNEXUS_REPO_NAME)/$(TAXNEXUS_REPO_NAME)_$(TAXNEXUS_BUILD_ENV):$(TAXNEXUS_VERSION) \
--tag $(TAXNEXUS_REGISTRY_PRIV)/taxnexus/$(TAXNEXUS_REPO_NAME)/$(TAXNEXUS_REPO_NAME)_$(TAXNEXUS_BUILD_ENV):latest \
--file ./build/Dockerfile \
.
mysql:
rm -rf swagger/mysql
mkdir swagger/mysql
docker run --rm \
-v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/swagger/rules-taxnexus.yaml \
-g mysql-schema \
-o /local/swagger/mysql