58 lines
1.7 KiB
Bash
Executable File
58 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
# --- CHECK PREREQUISITES -----------------------------------------------------
|
|
|
|
echo "Checking Docker installation..."
|
|
if ! command -v docker >/dev/null 2>&1; then
|
|
echo "Docker not found. Install Docker? [y/N]"
|
|
read -r install_docker
|
|
if [ "$install_docker" = "y" ] || [ "$install_docker" = "Y" ]; then
|
|
curl -fsSL https://get.docker.com | sh
|
|
else
|
|
echo "Docker is required. Exiting."
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "Docker is already installed."
|
|
fi
|
|
|
|
echo "Checking Docker Compose..."
|
|
if ! docker compose version >/dev/null 2>&1; then
|
|
echo "Docker Compose plugin missing. You may need to update Docker."
|
|
exit 1
|
|
else
|
|
echo "Docker Compose available."
|
|
fi
|
|
|
|
# --- LOAD ENV FILE ------------------------------------------------------------
|
|
|
|
if [ ! -f "Docker/.env" ]; then
|
|
echo ".env file not found in the current directory."
|
|
echo "Create one now? [y/N]"
|
|
read -r create_env
|
|
if [ "$create_env" = "y" ] || [ "$create_env" = "Y" ]; then
|
|
cp Docker/env.example Docker/.env 2>/dev/null || touch .env
|
|
echo "Created .env (./Docker/.env). Edit it before continuing."
|
|
exit 0
|
|
else
|
|
echo "A .env file is required. Exiting."
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "Using existing .env file (Docker/.env)."
|
|
fi
|
|
|
|
# --- START DOCKER COMPOSE -----------------------------------------------------
|
|
|
|
echo "Start containers now with docker compose up -d? [y/N]"
|
|
read -r start_containers
|
|
|
|
if [ "$start_containers" = "y" ] || [ "$start_containers" = "Y" ]; then
|
|
cd Docker
|
|
docker compose up -d
|
|
echo "Containers started."
|
|
else
|
|
echo "You can start containers manually with: docker compose up -d"
|
|
fi
|