-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (33 loc) · 1.1 KB
/
build-image.yml
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
name: Build Vigilo image and push to ECR
on:
push:
branches:
- main
jobs:
build_image:
name: Build Vigilo image and push to ECR
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.DEPLOY_IAM_ROLE }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, Tag, and Push Image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: vigilo
DOCKER_TAG: ${{ github.sha }}
run: |
docker build -t $REGISTRY/$REPOSITORY:$DOCKER_TAG -f Dockerfile .
docker tag $REGISTRY/$REPOSITORY:$DOCKER_TAG $REGISTRY/$REPOSITORY:latest
docker push $REGISTRY/$REPOSITORY:$DOCKER_TAG
docker push $REGISTRY/$REPOSITORY:latest