60 lines
2.0 KiB
Makefile
60 lines
2.0 KiB
Makefile
ENV=dev
|
|
VER=0.0.11
|
|
TAG=${ENV}-${VER}
|
|
TAG_ARM=${ENV}-arm-${VER}
|
|
REGISTRY=kube-reg.fairfaxmedia.net
|
|
#REGISTRY=direct.fairfaxmedia.net:1529
|
|
|
|
SVC=papi/svc1
|
|
DOCK_IMG=${REGISTRY}/${SVC}:${TAG}
|
|
DOCK_ARM=${REGISTRY}/${SVC}:${TAG_ARM}
|
|
LIVE_HOST:="http://localhost:8912"
|
|
|
|
clean:
|
|
rm -rf .pytest_cache
|
|
rm -rf .coverage
|
|
rm -rf report.xml
|
|
rm -rf test.db
|
|
rm -rf htmlcov
|
|
|
|
install.log: requirements.txt
|
|
pip3 install -r requirements.txt > install.log
|
|
report.xml: *.py
|
|
pytest --cov=papi --cov=posts --cov=users test_papi.py test_posts.py test_users.py --junitxml=report.xml --cov-report=html --cov-report=xml --cov-report=term --cov-fail-under 90
|
|
|
|
docker-img: report.xml
|
|
docker build -t ${DOCK_IMG} --push .
|
|
arm-builder:
|
|
docker buildx create --name mybuilder --use --bootstrap --platform arm64
|
|
docker-img-arm: report.xml
|
|
docker buildx build --builder mybuilder --platform linux/arm64 -t ${DOCK_ARM} --push . -f Dockerfile
|
|
|
|
ideploy: docker-img
|
|
helm --kube-context microk8s install papi-${ENV} ./papi-helm/ -f ./papi-helm/v.${ENV}.yaml --set image.tag=${TAG} --set env.VERSION=${VER} --set name=papi-${ENV}
|
|
|
|
deploy: docker-img
|
|
helm --kube-context microk8s upgrade papi-${ENV} ./papi-helm/ -f ./papi-helm/v.${ENV}.yaml --set image.tag=${TAG} --set env.VERSION=${VER} --set name=papi-${ENV}
|
|
|
|
ideploy-arm: docker-img-arm
|
|
helm --kube-context arm-k3s install papi-${ENV} ./papi-helm/ -f ./papi-helm/v.arm.${ENV}.yaml --set image.tag=${TAG_ARM} --set env.VERSION=${VER} --set name=papi-${ENV}
|
|
deploy-arm: docker-img-arm
|
|
helm --kube-context arm-k3s upgrade papi-${ENV} ./papi-helm/ -f ./papi-helm/v.arm.${ENV}.yaml --set image.tag=${TAG_ARM} --set env.VERSION=${VER} --set name=papi-${ENV}
|
|
integration:
|
|
pyresttest ${LIVE_HOST} integration.pyrest.yaml
|
|
|
|
|
|
|
|
arm-tok:
|
|
kubectl --context arm-k3s create token serviceaccounts-cluster-admin
|
|
echo login at https://k3a.fairfaxmedia.net
|
|
|
|
|
|
k8s-tok:
|
|
kubectl --context microk8s create token serviceaccounts-cluster-admin
|
|
echo login at https://kube.fairfaxmedia.net
|
|
|
|
run: install.log
|
|
uvicorn papi:app --reload --port 8912 --host 0.0.0.0
|
|
|
|
|
|
all: deploy |