-
Notifications
You must be signed in to change notification settings - Fork 39
48 lines (37 loc) · 1.23 KB
/
ecr_frontend.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
40
41
42
43
44
45
46
47
48
name: '[ECR] build & push frontend image'
run-name: '[ECR] build & push ${{ github.ref_name }}'
on:
push:
tags:
- "frontend/v*"
jobs:
build_and_push:
name: "Build Frontend Image From Git Tag"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: "Build & Push Frontend Docker Image"
env:
GIT_TAG: ${{ github.ref_name }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
run: |
TAG="${GIT_TAG##*/}"
IMAGE_URI=${AWS_ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/frontend
docker build \
--build-arg VERSION=$TAG \
-t $IMAGE_URI:$TAG \
-t $IMAGE_URI:latest \
-f nginx/ecs/Dockerfile \
.
docker push --all-tags $IMAGE_URI