#!/bin/bash set -e echo "=== Preparing the Kubernetes environment and building image ===" if ! minikube status | grep -q "Running"; then echo "Error: Minikube is not running. Please start it with 'minikube start'." exit 1 fi echo "[1/3] Pointing Docker CLI to minikube's Docker daemon..." eval $(minikube docker-env) echo "[2/3] Building the Docker image for the web application..." cd webapp docker build -t web-app:1.0 . cd .. echo "[3/3] Creating physical folders in Minikube for Persistent Volumes..." minikube ssh 'sudo mkdir -p /mnt/data/mysql' minikube ssh 'sudo chmod 777 /mnt/data/mysql' echo "=== Application successfully prepared! ==="