export REGISTRO=harbor.reymota.es\/reymota #export REGISTRO=registry.reymota.es export NAMESPACE = finanzas VERSION_FILE = .version # Get current version or default to alpine-1 IMG_VERSION := $(shell cat $(VERSION_FILE) 2>/dev/null || echo "alpine-1") # Get built version for deployment targets BUILT_VERSION := $(shell cat .current_version 2>/dev/null || echo "$(IMG_VERSION)") export IMG_VERSION # limpia todo all: imagen clean install imagen: @echo "Building image with version: $(IMG_VERSION)" @# Store current version for other targets to use @echo "$(IMG_VERSION)" > .current_version cd ../; make @# Increment version for next build @echo "$(IMG_VERSION)" | sed 's/alpine-\([0-9]*\)/alpine-\1/' | awk -F'-' '{print "alpine-" $$2+1}' > $(VERSION_FILE) @echo "Next version will be: $$(cat $(VERSION_FILE))" ns: -cat namespace.yaml | sed -e "s//${NAMESPACE}/" |kubectl create -f - install: -cat reg-secret.yaml| sed -e "s//${NAMESPACE}/" | kubectl create -f - -cat env-prod-configmap.yaml | sed -e "s//${NAMESPACE}/" | kubectl create -f - -cat secreto-db.yaml| sed -e "s//${NAMESPACE}/" | kubectl create -f - -cat finanzas-deployment.yaml | sed -e "s//${NAMESPACE}/" | sed -e "s//${BUILT_VERSION}/" | sed -e "s//${REGISTRO}/" | kubectl create -f - -cat finanzas-service.yaml | sed -e "s//${NAMESPACE}/" | kubectl create -f - -cat finanzas-ingress.yaml | sed -e "s//${NAMESPACE}/" | kubectl create -f - clean: -cat finanzas-ingress.yaml | sed -e "s//${NAMESPACE}/" | kubectl delete -f - -cat finanzas-deployment.yaml | sed -e "s//${NAMESPACE}/" | sed -e "s//${BUILT_VERSION}/" | sed -e "s//${REGISTRO}/" | kubectl delete -f - -cat finanzas-service.yaml | sed -e "s//${NAMESPACE}/" | kubectl delete -f - -cat secreto-db.yaml| sed -e "s//${NAMESPACE}/" | kubectl delete -f - -cat env-prod-configmap.yaml | sed -e "s//${NAMESPACE}/" | kubectl delete -f - -cat reg-secret.yaml | sed -e "s//${NAMESPACE}/" | kubectl delete -f - borraclaims: -cat pvc-finanzas.yaml | sed -e "s//${NAMESPACE}/" | kubectl delete -f - -cat pvc-static.yaml | sed -e "s//${NAMESPACE}/" | kubectl delete -f - claims: -cat pvc-finanzas.yaml | sed -e "s//${NAMESPACE}/" | kubectl create -f - -cat pvc-static.yaml | sed -e "s//${NAMESPACE}/" | kubectl create -f - app: -cat finanzas-deployment.yaml | sed -e "s//${NAMESPACE}/" | sed -e "s//${BUILT_VERSION}/" | sed -e "s//${REGISTRO}/" | kubectl delete -f - -cat finanzas-deployment.yaml | sed -e "s//${NAMESPACE}/" | sed -e "s//${BUILT_VERSION}/" | sed -e "s//${REGISTRO}/" | kubectl create -f - db: -kubectl create -f finanzas-db.yaml