Created
May 27, 2015 16:26
-
-
Save bobmaerten/34aef05fffe605673466 to your computer and use it in GitHub Desktop.
Run PHP CLI script with Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
die() { echo "$@" 1>&2 ; exit 1; } | |
[ "$#" -ne 1 ] && die "usage: $0 <php script>" | |
head -n 1 $1 | grep -q "^<?php" || die "error: only runs php scripts" | |
eval "$(docker-machine env dev)" | |
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp php:5.6-cli php $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment