Skip to content

Instantly share code, notes, and snippets.

@troke12
Created July 18, 2022 07:18
Show Gist options
  • Save troke12/148383c2521ddeba09069449b502f669 to your computer and use it in GitHub Desktop.
Save troke12/148383c2521ddeba09069449b502f669 to your computer and use it in GitHub Desktop.
Building docker with current branch
#!/bin/bash
branch=$(git symbolic-ref --short HEAD)
case $branch in
"development")
prefix="dev"
cp .env.development .env
;;
"staging")
prefix="stag"
cp .env.staging .env
;;
"master" | *)
prefix="master"
echo "done master"
;;
esac
echo "\nStarting building docker..."
docker build . -t chatnews-$prefix:latest
git restore .env
echo "\nSuccess restoring .env.."
echo "\nDone Building Docker in branch $branch"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment