Last active
August 29, 2015 14:18
-
-
Save gtramontina/e5766c9de4458f66cc9d to your computer and use it in GitHub Desktop.
Given a git repository with a `Dockerfile`, this runs the given command within the container in the context of your repository.
This file contains 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 -e | |
if [[ -z "$1" ]] | |
then | |
echo "Please specify a command to run inside the container." | |
exit 1 | |
fi | |
COMMAND=$1 | |
IMAGE=`git rev-parse HEAD` | |
WORKSPACE=/opt/workspace | |
docker build -t $IMAGE . | |
docker run --rm -v `pwd`:${WORKSPACE} ${IMAGE} ${WORKSPACE}/${COMMAND} | |
docker rmi $IMAGE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run:
(the bit.ly url is just a short for the raw file)