Skip to content

Commit

Permalink
Chore : AWS ECR에 도커 이미지 자동 푸시
Browse files Browse the repository at this point in the history
  • Loading branch information
lhw414 committed Jan 2, 2024
1 parent 59e248c commit 4d33b68
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy to ECR
# 배포 테스트 단계 : dev/auto-deploy에 push되는 코드가 aws에 올라가는지 확인
on:
push:
branches: [ main ]

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
env:
IMAGE_TAG: v${{ github.run_number }}
ECR_REGISTRY: 900017126942.dkr.ecr.ap-northeast-2.amazonaws.com
ECR_REPOSITORY: team3-server

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Login to ECR
uses: aws-actions/amazon-ecr-login@v1

- name: Docker build, tag, and push image to ECR
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"

0 comments on commit 4d33b68

Please sign in to comment.