Skip to content

Instantly share code, notes, and snippets.

@astehlik
Created November 22, 2019 12:26
Show Gist options
  • Save astehlik/2b94d0bdde999d16740c06f43946c7a7 to your computer and use it in GitHub Desktop.
Save astehlik/2b94d0bdde999d16740c06f43946c7a7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
THIS_SCRIPT_DIR="$( cd "$( dirname `readlink -f "${BASH_SOURCE[0]}"` )" >/dev/null && pwd )"
phpVersion=7.2
remainingArguments="$@"
if [[ "$1" =~ (5.6|7.0|7.1|7.2|7.3) ]]; then
phpVersion=$1
remainingArguments="${@:2}"
fi
${THIS_SCRIPT_DIR}/docker_php.sh ${phpVersion} /usr/local/bin/composer.phar ${remainingArguments}
#!/usr/bin/env bash
phpVersion=7.2
remainingArguments="$@"
if [[ "$1" =~ (5.6|7.0|7.1|7.2|7.3) ]]; then
phpVersion=$1
remainingArguments="${@:2}"
fi
echo "Using PHP version $phpVersion"
docker run --interactive --rm --tty \
--user $(id -u):$(id -g) \
-v ${HOME}/.ssh:${HOME}/.ssh:rw \
-v ${SSH_AUTH_SOCK}:/ssh-auth.sock \
--env SSH_AUTH_SOCK=/ssh-auth.sock \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/passwd:/etc/group:ro \
-v ${HOME}/.config/composer:${HOME}/.config/composer:rw \
-v ${HOME}/.cache/composer:${HOME}/.cache/composer:rw \
--env COMPOSER_CACHE_DIR=${HOME}/.cache/composer \
--env COMPOSER_HOME=${HOME}/.config/composer \
-v "$(pwd)":"$(pwd)":rw -w "$(pwd)" \
--add-host db:127.0.0.1 \
--net=host \
intera/docker-ci-php:${phpVersion}-ubuntu \
php${phpVersion} ${remainingArguments}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment