Skip to content

Instantly share code, notes, and snippets.

@greenbicycle
Created August 30, 2024 16:29
Show Gist options
  • Save greenbicycle/3c5db0aab41fa5420dbce5a82a76f6d7 to your computer and use it in GitHub Desktop.
Save greenbicycle/3c5db0aab41fa5420dbce5a82a76f6d7 to your computer and use it in GitHub Desktop.
Run a specific version of php
#!/bin/bash
# usage: php8.3-cli.sh <command>
CONTAINER=php:8.3-alpine
docker run -it --rm --name php83 \
-v "$PWD":/code \
-v ~/.composer:/root/.composer \
-v ~/bin:/usr/local/sbin \
-w /code \
$CONTAINER $@
@greenbicycle
Copy link
Author

The volumes aren't required, but will give you more functionality, since the container will not have anything installed in it automatically.

In my bin/ directory, I have things like composer, and phpcs, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment