Skip to content

Instantly share code, notes, and snippets.

@wilcorrea
Created July 30, 2025 13:05
Show Gist options
  • Select an option

  • Save wilcorrea/10ce5495a4410d23463ff31ed87993d2 to your computer and use it in GitHub Desktop.

Select an option

Save wilcorrea/10ce5495a4410d23463ff31ed87993d2 to your computer and use it in GitHub Desktop.
dockerized php
#!/bin/bash
ACTION="$1"
case ${ACTION} in
"stop")
docker stop php-cli
;;
"start")
docker run --rm --name php-cli -i -t -d \
--workdir "$(pwd)" \
--volume "$(pwd):$(pwd)" \
--entrypoint /bin/sh \
--platform linux/amd64 \
devitools/hyperf:8.3-dev &>/dev/null
;;
*)
if [ -z "$(docker ps -a | grep php-cli)" ]; then
echo "PHP is not running"
echo " use: php up"
exit 1
fi
echo "$@" > /var/log/php/php.log
docker exec php-cli php $@
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment