forked from apoclyps/my-dev-space
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-push.sh
executable file
·69 lines (61 loc) · 2.88 KB
/
docker-push.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
if [ -z "$TRAVIS_PULL_REQUEST" ] || [ "$TRAVIS_PULL_REQUEST" == "false" ]
then
if [ "$TRAVIS_BRANCH" == "staging" ] || [ "$TRAVIS_BRANCH" == "production" ]
then
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
./awscli-bundle/install -b ~/bin/aws
export PATH=~/bin:$PATH
eval $(aws ecr get-login --region us-east-1 --no-include-email)
export TAG=$TRAVIS_BRANCH
export REPO=$AWS_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com
fi
if [ "$TRAVIS_BRANCH" == "staging" ]
then
export REACT_APP_USERS_SERVICE_URL="http://my-dev-space-staging-alb-2128504978.us-east-1.elb.amazonaws.com"
export REACT_APP_EVENTS_SERVICE_URL="http://my-dev-space-staging-alb-2128504978.us-east-1.elb.amazonaws.com"
export REACT_APP_GOOGLE_ANALYTICS_ID="UA-123052755-2"
export SECRET_KEY="$STAGING_SECRET_KEY"
export NEW_RELIC_LICENSE_KEY="$NEW_RELIC_LICENSE_KEY"
export AWS_RDS_EVENTS_STAGING_URI="$AWS_RDS_EVENTS_STAGING_URI"
export AWS_RDS_USERS_STAGING_URI="$AWS_RDS_USERS_STAGING_URI"
fi
if [ "$TRAVIS_BRANCH" == "production" ]
then
export REACT_APP_USERS_SERVICE_URL="https://muxer.co.uk"
export REACT_APP_EVENTS_SERVICE_URL="https://muxer.co.uk"
export REACT_APP_GOOGLE_ANALYTICS_ID="UA-123052755-3"
export SECRET_KEY="$PRODUCTION_SECRET_KEY"
export NEW_RELIC_LICENSE_KEY="$NEW_RELIC_LICENSE_KEY"
export AWS_RDS_EVENTS_URI="$AWS_RDS_EVENTS_URI"
export AWS_RDS_USERS_URI="$AWS_RDS_USERS_URI"
fi
if [ "$TRAVIS_BRANCH" == "staging" ] || [ "$TRAVIS_BRANCH" == "production" ]
then
echo "Building: ${USERS_DIR} for ${USERS}:${COMMIT} to push ${REPO}/${USERS}/${TAG}"
cd $USERS_DIR
docker build -t $USERS:$COMMIT -f Dockerfile-$DOCKER_ENV .
docker tag $USERS:$COMMIT $REPO/$USERS:$TAG
docker push $REPO/$USERS:$TAG
cd ../../
echo "Building: ${EVENTS_DIR} for ${EVENTS}:${COMMIT} to push ${REPO}/${EVENTS}/${TAG}"
cd $EVENTS_DIR
docker build -t $EVENTS:$COMMIT -f Dockerfile-$DOCKER_ENV .
docker tag $EVENTS:$COMMIT $REPO/$EVENTS:$TAG
docker push $REPO/$EVENTS:$TAG
cd ../../
echo "Building: ${CLIENT_DIR} for ${CLIENT}:${COMMIT} to push ${REPO}/${CLIENT}/${TAG}"
cd $CLIENT_DIR
docker build -t $CLIENT:$COMMIT -f Dockerfile-$DOCKER_ENV --build-arg REACT_APP_USERS_SERVICE_URL=$REACT_APP_USERS_SERVICE_URL --build-arg REACT_APP_EVENTS_SERVICE_URL=$REACT_APP_EVENTS_SERVICE_URL --build-arg REACT_APP_GOOGLE_ANALYTICS_ID=$REACT_APP_GOOGLE_ANALYTICS_ID .
docker tag $CLIENT:$COMMIT $REPO/$CLIENT:$TAG
docker push $REPO/$CLIENT:$TAG
cd ../../
echo "Building: ${SWAGGER_DIR} for ${SWAGGER}:${COMMIT} to push ${REPO}/${SWAGGER}/${TAG}"
cd $SWAGGER_DIR
docker build -t $SWAGGER:$COMMIT -f Dockerfile-$DOCKER_ENV .
docker tag $SWAGGER:$COMMIT $REPO/$SWAGGER:$TAG
docker push $REPO/$SWAGGER:$TAG
cd ../../
fi
fi