-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (32 loc) · 1.5 KB
/
upload-cache.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
name: Build and Push to ECR and Deploy cache
on:
push:
paths-ignore:
- 's3/**'
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up AWS CLI
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_REGION_NAME }} # AWS 리전 설정
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build Docker Image
run: |
docker build --build-arg AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} --build-arg AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} --build-arg AWS_REGION_NAME_NAME=${{ secrets.AWS_REGION_NAME }} -t ssudobi-cache:latest .
docker tag ssudobi-cache:latest ${{secrets.AWS_ACCOUNTID}}.dkr.ecr.${{secrets.AWS_REGION_NAME}}.amazonaws.com/lambda_ssudobi_cache:latest
- name: Push Docker Image to ECR
run: |
docker push ${{secrets.AWS_ACCOUNTID}}.dkr.ecr.${{secrets.AWS_REGION_NAME}}.amazonaws.com/lambda_ssudobi_cache:latest
- name: Deploy ssudobi-cache function
run: |
aws lambda update-function-code --function-name ssudobi_cache --image-uri ${{secrets.AWS_ACCOUNTID}}.dkr.ecr.${{secrets.AWS_REGION_NAME}}.amazonaws.com/lambda_ssudobi_cache:latest