feat: Add podman support

This commit is contained in:
Carlos Álvaro 2024-05-12 18:50:33 +02:00
parent d67a852ae8
commit d10b550878
No known key found for this signature in database
GPG Key ID: E0F9B75C3246CEB5

View File

@ -2,19 +2,31 @@
# Verifies that files passed in are valid for docker-compose # Verifies that files passed in are valid for docker-compose
set -e set -e
if command -v docker &> /dev/null && docker help compose &> /dev/null; then # Check if docker or podman commands are available
COMPOSE="docker compose" if [[ -z "${CONTAINER_ENGINE}" ]]; then
elif command -v docker-compose &> /dev/null ; then if command -v docker &>/dev/null; then
COMPOSE=docker-compose CONTAINER_ENGINE=docker
elif command -v podman &>/dev/null; then
CONTAINER_ENGINE=podman
else else
echo "ERROR: Neither 'docker-compose' or 'docker compose' were found" echo "ERROR: Neither 'docker' or 'podman' were found"
exit 1
fi
fi
if command -v "${CONTAINER_ENGINE}" &>/dev/null && ${CONTAINER_ENGINE} help compose &> /dev/null; then
COMPOSE="${CONTAINER_ENGINE} compose"
elif command -v "${CONTAINER_ENGINE}-compose" &> /dev/null; then
COMPOSE="${CONTAINER_ENGINE}-compose"
else
echo "ERROR: Neither '${CONTAINER_ENGINE}-compose' or '${CONTAINER_ENGINE} compose' were found"
exit 1 exit 1
fi fi
check_file() { check_file() {
local file=$1 local file=$1
env $COMPOSE --file "$file" config --quiet 2>&1 \ env $COMPOSE --file "$file" config --quiet 2>&1 |
| sed "/variable is not set. Defaulting/d" sed "/variable is not set. Defaulting/d"
return "${PIPESTATUS[0]}" return "${PIPESTATUS[0]}"
} }