Skip to content

Commit 103b25d

Browse files
add build and push steps for Docker image to Amazon ECR in CI workflow
1 parent e947792 commit 103b25d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,17 @@ jobs:
4747
- name: Login to Amazon ECR
4848
id: login-ecr
4949
uses: aws-actions/amazon-ecr-login@v1
50+
51+
- name: Build, tag, and push image to Amazon ECR
52+
id: build-image
53+
env:
54+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
55+
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_NAME }}
56+
IMAGE_TAG: latest
57+
run: |
58+
# Build a docker container and
59+
# push it to ECR so that it can
60+
# be deployed to ECS.
61+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
62+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
63+
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"

0 commit comments

Comments
 (0)