Skip to content

Instantly share code, notes, and snippets.

@Flower7C3
Last active June 24, 2024 17:11
Show Gist options
  • Save Flower7C3/be4f62067d17b6c57cdbda2a38e6b368 to your computer and use it in GitHub Desktop.
Save Flower7C3/be4f62067d17b6c57cdbda2a38e6b368 to your computer and use it in GitHub Desktop.
On demand tools on Docker
#!/usr/bin/env bash
## save as /usr/local/bin/blt and run `chmod +x /usr/local/bin/blt`
docker run --platform=linux/amd64 --rm --interactive --tty \
-v "$PWD":/app -w /app \
cbcms/blt $@
#!/usr/bin/env bash
## save as /usr/local/bin/composer and run `chmod +x /usr/local/bin/composer`
docker run --platform=linux/amd64 --rm --interactive --tty \
--volume $PWD:/app \
--volume ${COMPOSER_HOME:-$HOME/.composer}:/tmp \
composer $@
#!/usr/bin/env bash
## save as /usr/local/bin/drush and run `chmod +x /usr/local/bin/drush`
docker run --platform=linux/amd64 --rm --interactive --tty \
-v "$PWD":/app -w /app \
drush/drush $@
#!/usr/bin/env bash
## save as /usr/local/bin/php and run `chmod +x /usr/local/bin/php`
POSITIONAL_ARGS=()
version="8.2"
while [ $# -gt 0 ]; do
case "$1" in
-V=*)
version="${1#*=}"
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
;;
esac
shift
done
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
docker run --platform=linux/amd64 --rm --interactive --tty \
-v "$PWD":/usr/src/myapp -w /usr/src/myapp \
php:$version php $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment