Skip to content

Instantly share code, notes, and snippets.

@roobie
Created June 9, 2020 13:58
Show Gist options
  • Save roobie/eda70d00765e3978b25efbb7d054752b to your computer and use it in GitHub Desktop.
Save roobie/eda70d00765e3978b25efbb7d054752b to your computer and use it in GitHub Desktop.
app in docker as paas
#!/usr/bin/env bash
set -e
set -u
export BASEDIR="$HOME"
export APP=appname
export APPDIR="$BASEDIR/$APP"
export DOCKER_OPTS=""
unset GIT_DIR
GIT_WORK_TREE=$APPDIR git checkout master
cd $APPDIR && \
echo building image && \
docker build -t $APP .
if [[ "$?" != "0" ]]; then
echo "error while building image."
exit 1
fi
echo "Stopping previous container..."
docker stop $APP
echo "Starting new container..."
sleep 1
docker run -d --name $APP --rm $APP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment