Skip to content

Instantly share code, notes, and snippets.

@gtramontina gtramontina/dockerize
Last active Aug 29, 2015

Embed
What would you like to do?
Given a git repository with a `Dockerfile`, this runs the given command within the container in the context of your repository.
#!/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
@gtramontina

This comment has been minimized.

Copy link
Owner Author

commented Apr 7, 2015

To run:

curl -Ls http://bit.ly/1NRiAQS | bash -s <YOUR_COMMAND>

(the bit.ly url is just a short for the raw file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.