File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,16 +17,38 @@ jobs:
1717 - name : Checkout code
1818 uses : actions/checkout@v3
1919
20+ - name : Configure AWS credentials
21+ uses : aws-actions/configure-aws-credentials@v1
22+ with :
23+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
24+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
25+ aws-region : ap-northeast-2
26+
27+ - name : Login to Amazon ECR
28+ id : login-ecr
29+ uses : aws-actions/amazon-ecr-login@v1
30+
31+ - name : Set up Docker Buildx
32+ uses : docker/setup-buildx-action@v2
33+
34+ - name : Build and push
35+ uses : docker/build-push-action@v4
36+ with :
37+ context : .
38+ platforms : linux/amd64,linux/arm64
39+ push : true
40+ tags : 867344478016.dkr.ecr.ap-northeast-2.amazonaws.com/enjoy-app:latest
41+
2042 - name : SSH into EC2 server and deploy
2143 uses : appleboy/ssh-action@master
2244 with :
2345 host : ${{ secrets.EC2_HOST }}
2446 username : ec2-user
2547 key : ${{ secrets.SSH_PRIVATE_KEY }}
48+ timeout : 300s
2649 script : |
2750 cd /home/ec2-user/back
28- git pull origin main
2951 docker-compose down
52+ docker pull 867344478016.dkr.ecr.ap-northeast-2.amazonaws.com/enjoy-app:latest
3053 docker system prune -f
31- docker build -t enjoy-app .
3254 docker-compose up -d
You can’t perform that action at this time.
0 commit comments