Skip to content

Commit

Permalink
feat: Container runtime detection (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioheleno authored Mar 15, 2024
1 parent 92ca980 commit 38165c5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bin/phpctl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@ fi
PHP_VERSION=${PHP_VERSION:-82}
PHPCTL_IMAGE=${PHPCTL_IMAGE:-opencodeco/phpctl:php$PHP_VERSION}
PHPCTL_TTY=${PHPCTL_TTY:--it}
PHPCTL_RUNTIME=${PHPCTL_RUNTIME:-docker}
PHPCTL_RUNTIME=${PHPCTL_RUNTIME:-detect}
PHPCTL_USER=${PHPCTL_USER:-root}

if [ "${PHPCTL_RUNTIME}" == "detect" ]; then
PHPCTL_RUNTIME=
if command -v docker > /dev/null 2>&1; then
PHPCTL_RUNTIME=docker
elif command -v podman > /dev/null 2>&1; then
PHPCTL_RUNTIME=podman
else
echo "Could not find neither \"docker\" nor \"podman\", aborting"
exit 1
fi
fi

for file in "$PHPCTL_DIR"/src/*.sh; do
# shellcheck source=src/php.sh
. "$file"
Expand Down

0 comments on commit 38165c5

Please sign in to comment.