-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (43 loc) · 1.96 KB
/
deploy.yml
File metadata and controls
47 lines (43 loc) · 1.96 KB
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
name: Python CI
on:
push:
branches: [ "deploy" ]
pull_request:
branches: [ "deploy" ]
jobs:
build:
## checkout후 자바 21 버전으로 설정을 합니다
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
## 이미지 태그에 시간 설정을 하기위해서 현재 시간을 가져옵니다.
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00"
- name: Show Current Time
run: echo "CurrentTime=${{steps.current-time.outputs.formattedTime}}"
## AWS에 로그인합니다. aws-region은 서울로 설정(ap-northeast-2)했습니다
- 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: us-east-1
## ECR에 로그인합니다
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
## sample라는 ECR 리파지터리에 현재 시간 태그를 생성하고, 푸쉬합니다.
## 앞의 스탭에서 ${{steps.current-time.outputs.formattedTime}}로 현재 시간을 가져옵니다.
- name: Build, tag, and push image to Amazon ECR
run: |
docker build -t awesome_ai:${{steps.current-time.outputs.formattedTime}} .
docker tag awesome_ai:${{steps.current-time.outputs.formattedTime}} public.ecr.aws/l0d7n0a1/awesome_ai:${{steps.current-time.outputs.formattedTime}}
docker push public.ecr.aws/l0d7n0a1/awesome_ai:${{steps.current-time.outputs.formattedTime}}
docker tag awesome_ai:${{steps.current-time.outputs.formattedTime}} public.ecr.aws/l0d7n0a1/awesome_ai:latest
docker push public.ecr.aws/l0d7n0a1/awesome_ai:latest