Adjusted docker build script

This commit is contained in:
Wyatt Johnson
2017-03-30 11:37:18 -06:00
parent 0dc105405c
commit 126387becc
2 changed files with 20 additions and 11 deletions
+2 -2
View File
@@ -47,9 +47,9 @@ deployment:
release:
tag: /v[0-9]+(\.[0-9]+)*/
commands:
- bash ./scripts/deploy.sh
- bash ./scripts/docker.sh deploy
latest:
branch: master
commands:
- bash ./scripts/deploy.sh
- bash ./scripts/docker.sh deploy
+18 -9
View File
@@ -2,9 +2,7 @@
set -e
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
# Sourced from https://segment.com/blog/ci-at-segment/
# Inspired by https://segment.com/blog/ci-at-segment/
deploy_tag() {
# Find our individual versions from the tags
@@ -50,10 +48,21 @@ deploy_latest() {
docker build -t coralproject/talk:latest -f Dockerfile .
docker build -t coralproject/talk:latest-onbuild -f Dockerfile.onbuild .
# deploy based on the env
if [ -n "$CIRCLE_TAG" ]
if [ "$1" -eq "deploy" ]
then
deploy_tag
else
deploy_latest
fi
if [[ -n "$DOCKER_EMAIL" && -n "$DOCKER_USER" && -n "$DOCKER_PASS" ]]
then
# Log the Docker Daemon in
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
fi
# deploy based on the env
if [ -n "$CIRCLE_TAG" ]
then
deploy_tag
else
deploy_latest
fi
fi