Skip to content

Instantly share code, notes, and snippets.

@sordina
Created March 7, 2016 03:42
Show Gist options
  • Save sordina/f5f9f0226db3110311ea to your computer and use it in GitHub Desktop.
Save sordina/f5f9f0226db3110311ea to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
echo "$@"
if [ -f .dockername ]
then
N=$(cat .dockername)
else
N=$(basename $(pwd))-$$
echo $N > .dockername
fi
echo "Using docker image id $N" 1>&2
if [ -t 0 ]
then
TTYFLAG=" -t "
else
TTYFLAG=" "
fi
docker build -t $N . 1>&2
# docker tag -f $N $N:squashed 1>&2
docker run $TTYFLAG -a stdin -a stdout -a stderr --env-file <(env) -P -i $N $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment