Created
June 9, 2020 13:58
-
-
Save roobie/eda70d00765e3978b25efbb7d054752b to your computer and use it in GitHub Desktop.
app in docker as paas
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 | |
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