Skip to content

Commit 85f5107

Browse files
committed
...
1 parent dbe7342 commit 85f5107

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- run: set +o pipefail docker load -i /caches/app.tar | true
1818

1919
# Building.
20-
- run: docker build --build-arg ENV=development --cache-from=$DEV_AWS_ACCOUNT_ID.dkr.ecr.$DEV_AWS_REGION.amazonaws.com/community-app -t $DEV_AWS_ACCOUNT_ID.dkr.ecr.$DEV_AWS_REGION.amazonaws.com/community-app .
20+
- run: docker build --build-arg ENV=development --cache-from=$DEV_AWS_ACCOUNT_ID.dkr.ecr.$DEV_AWS_REGION.amazonaws.com/community-app -t $DEV_AWS_ACCOUNT_ID.dkr.ecr.$DEV_AWS_REGION.amazonaws.com/community-app:$CIRCLE_SHA1 .
2121

2222
# Updating the cache.
2323
- run: mkdir -p /caches && docker save -o /caches/app.tar $DEV_AWS_ACCOUNT_ID.dkr.ecr.$DEV_AWS_REGION.amazonaws.com/community-app
@@ -27,10 +27,10 @@ jobs:
2727
- /caches/app.tar
2828

2929
# Deployment.
30-
- run: apk add --update bash py-pip
31-
- run: pip install awscli --upgrade --user
30+
- run: apk add --update bash jq py-pip sudo
31+
- run: sudo pip install awscli --upgrade
3232
- deploy:
33-
command: ./deploy.sh DEV
33+
command: ./deploy.sh DEV $CIRCLE_SHA1
3434

3535
# Test job for the cases when we do not need deployment. It just rapidly
3636
# installs (updates) app dependencies, and runs tests (ESLint, Stylelint,

deploy.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
JQ="jq --raw-output --exit-status"
55

66
ENV=$1
7+
TAG=$2
78

89
AWS_REGION=$(eval "echo \$${ENV}_AWS_REGION")
910
AWS_ECS_CLUSTER=$(eval "echo \$${ENV}_AWS_ECS_CLUSTER")
@@ -75,13 +76,13 @@ make_task_def(){
7576
NODE_ENV=development
7677
fi
7778

78-
task_def=$(printf "$task_template" $ACCOUNT_ID $AWS_REGION $AWS_REPOSITORY $NODE_ENV $AWS_ECS_CLUSTER $AWS_REGION)
79+
task_def=$(printf "$task_template" $ACCOUNT_ID $AWS_REGION $AWS_REPOSITORY $TAG $NODE_ENV $AWS_ECS_CLUSTER $AWS_REGION)
7980
}
8081

8182
push_ecr_image() {
8283
echo "Pushing Docker Image..."
8384
eval $(aws ecr get-login --region $AWS_REGION)
84-
docker push $ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_REPOSITORY
85+
docker push $ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_REPOSITORY:$TAG
8586
echo "Docker Image published."
8687
}
8788

0 commit comments

Comments
 (0)