zkt26/z2/prepare-app.sh
2026-04-28 15:09:21 +02:00

24 lines
657 B
Bash
Executable File

#!/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! ==="