zkt24-sk1/scripts/start-app.sh

51 lines
1.1 KiB
Bash

#!/bin/bash
# Build de los microservicios con Maven
echo "Building microservices..."
cd ../shoptfront-productcatalogue-stockmanager-Kubernetes
minikube start
cd shoptfront
mvn clean package
cd ..
cd ../productcatalogue
mvn clean package
cd ..
cd ../stockmanager
mvn clean package
cd ..
# Creación de imágenes Docker
echo "Building Docker images..."
cd shoptfront
docker build -t shoptfront:latest .
cd ../productcatalogue
docker build -t productcatalogue:latest .
cd ../stockmanager
docker build -t stockmanager:latest .
cd ..
# Despliegue en Kubernetes
echo "Deploying to Kubernetes..."
kubectl apply -f shoptfront-productcatalogue-stockmanager-kubernetes/kubernetes/shopfront-service.yaml
kubectl apply -f shoptfront-productcatalogue-stockmanager-kubernetes/kubernetes/productcatalogue-service.yaml
kubectl apply -f shoptfront-productcatalogue-stockmanager-kubernetes/kubernetes/stockmanager-service.yaml
# Openning services
minikube service shoptfront-service.yaml
minikube service productcatalogue-service.yaml
minikube service stockmanager-service.yaml