This repository has been archived by the owner on May 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
deploy.sh
executable file
·42 lines (33 loc) · 1.58 KB
/
deploy.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
#!/bin/sh
#Change these to match your environment
REGION=us-east-1 # do not change this since ECR is available only in us-east-1
DOCKER_REGISTRY=
DOCKER_REPO=svc-sundial
# An s3 bucket for deployment assets
CODEDEPLOY_S3_BUCKET=
sbt clean stage
#Only needed if you're using EC2 Container Registry
$(aws ecr get-login --region $REGION)
BUILD_ID=$(git describe --tags --dirty --always | sed "s/^v//")
docker build -t $DOCKER_REGISTRY/$DOCKER_REPO:$BUILD_ID .
docker push $DOCKER_REGISTRY/$DOCKER_REPO:$BUILD_ID
m4 -D_BUILD_ID_=$BUILD_ID -D_DOCKER_REPO_=$DOCKER_REPO -D_DOCKER_REGISTRY_=$DOCKER_REGISTRY codedeploy/start.template > codedeploy/start.sh
m4 -D_BUILD_ID_=$BUILD_ID codedeploy/stop.template > codedeploy/stop.sh
m4 -D_BUILD_ID_=$BUILD_ID codedeploy/healthcheck.template > codedeploy/healthcheck.sh
chmod +x codedeploy/start.sh
chmod +x codedeploy/stop.sh
chmod +x codedeploy/healthcheck.sh
aws deploy push \
--application-name Sundial \
--ignore-hidden-files \
--s3-location s3://$CODEDEPLOY_S3_BUCKET/$DOCKER_REPO/${BUILD_ID}.zip \
--source codedeploy/ \
--description "Revision from $DOCKER_REPO build $BUILD_ID ."
rm -vf codedeploy/start.sh
rm -vf codedeploy/stop.sh
rm -vf codedeploy/healthcheck.sh
aws deploy create-deployment \
--application-name Sundial \
--deployment-group-name SundialProd \
--s3-location bucket=$CODEDEPLOY_S3_BUCKET,key=$DOCKER_REPO/${BUILD_ID}.zip,bundleType=zip \
--description "Revision from $DOCKER_REPO build $BUILD_ID ."