Podman support

This commit is contained in:
StewKI
2026-05-17 16:04:22 +02:00
parent 8dae336819
commit 1970610b4d
2 changed files with 17 additions and 7 deletions

View File

@@ -7,15 +7,20 @@ ROOT_PASSWORD="ewc2025root"
DATABASE="ewc2025"
PORT="13306"
RUNTIME="docker"
if [[ "${1:-}" == "--podman" ]]; then
RUNTIME="podman"
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SQL_DIR="$(cd "${SCRIPT_DIR}/../sql" && pwd)"
if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER}$"; then
if ${RUNTIME} ps -a --format '{{.Names}}' | grep -q "^${CONTAINER}$"; then
echo "Container '${CONTAINER}' already exists — starting it."
docker start "${CONTAINER}"
${RUNTIME} start "${CONTAINER}"
else
echo "Creating and starting '${CONTAINER}'."
docker run -d \
echo "Creating and starting '${CONTAINER}' using ${RUNTIME}."
${RUNTIME} run -d \
--name "${CONTAINER}" \
-e MYSQL_ROOT_PASSWORD="${ROOT_PASSWORD}" \
-e MYSQL_DATABASE="${DATABASE}" \
@@ -26,7 +31,7 @@ else
fi
echo "Waiting for MySQL to be ready..."
until docker exec "${CONTAINER}" mysqladmin ping -uroot -p"${ROOT_PASSWORD}" --silent 2>/dev/null; do
until ${RUNTIME} exec "${CONTAINER}" mysqladmin ping -uroot -p"${ROOT_PASSWORD}" --silent 2>/dev/null; do
sleep 1
done