70 lines
2.0 KiB
Makefile
70 lines
2.0 KiB
Makefile
# Makefile for MerchantsOfHope.org deployment
|
|
|
|
.PHONY: help build docker-build docker-push deploy undeploy helm-install helm-uninstall k8s-apply k8s-delete test
|
|
|
|
# Default target
|
|
help:
|
|
@echo "Usage: make [target]"
|
|
@echo ""
|
|
@echo "Targets:"
|
|
@echo " help Show this help message"
|
|
@echo " build Build the application"
|
|
@echo " docker-build Build the Docker image"
|
|
@echo " docker-push Push the Docker image to registry"
|
|
@echo " deploy Deploy to Kubernetes using manifests"
|
|
@echo " undeploy Remove deployment from Kubernetes"
|
|
@echo " helm-install Install using Helm"
|
|
@echo " helm-uninstall Uninstall using Helm"
|
|
@echo " k8s-apply Apply Kubernetes manifests"
|
|
@echo " k8s-delete Delete Kubernetes resources"
|
|
@echo " test Run tests"
|
|
|
|
# Build the application
|
|
build:
|
|
composer install --no-dev --optimize-autoloader
|
|
|
|
# Build Docker image
|
|
docker-build:
|
|
docker build -t qwen-hack-moh:latest .
|
|
|
|
# Push Docker image to registry
|
|
docker-push:
|
|
docker tag qwen-hack-moh:latest qwen-hack-moh:$(shell git rev-parse --short HEAD)
|
|
docker push qwen-hack-moh:$(shell git rev-parse --short HEAD)
|
|
docker push qwen-hack-moh:latest
|
|
|
|
# Deploy using kubectl
|
|
deploy: k8s-apply
|
|
|
|
# Remove deployment
|
|
undeploy: k8s-delete
|
|
|
|
# Install using Helm
|
|
helm-install:
|
|
helm install moh-app ./helm/moh-app --namespace merchantsofhope --create-namespace
|
|
|
|
# Uninstall using Helm
|
|
helm-uninstall:
|
|
helm uninstall moh-app --namespace merchantsofhope
|
|
|
|
# Apply Kubernetes manifests
|
|
k8s-apply:
|
|
kubectl apply -f k8s/namespace.yaml
|
|
kubectl apply -f k8s/configmap.yaml
|
|
kubectl apply -f k8s/secrets.yaml
|
|
kubectl apply -f k8s/service.yaml
|
|
kubectl apply -f k8s/deployment.yaml
|
|
kubectl apply -f k8s/ingress.yaml
|
|
|
|
# Delete Kubernetes resources
|
|
k8s-delete:
|
|
kubectl delete -f k8s/ingress.yaml
|
|
kubectl delete -f k8s/deployment.yaml
|
|
kubectl delete -f k8s/service.yaml
|
|
kubectl delete -f k8s/secrets.yaml
|
|
kubectl delete -f k8s/configmap.yaml
|
|
kubectl delete -f k8s/namespace.yaml
|
|
|
|
# Run tests
|
|
test:
|
|
vendor/bin/phpunit
|