fix: fix workflow #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Push to ECR | |
on: | |
push: | |
branches: [ "bug/cicd" ] | |
env: | |
AWS_REGION: ap-northeast-2 | |
ECR_REGISTRY: 654654448479.dkr.ecr.ap-northeast-2.amazonaws.com | |
ECR_REPOSITORY: repick-repo | |
IMAGE_TAG: 49119eb9a24649b0efd4bac3113fdb6655539606 | |
permissions: | |
contents: read | |
jobs: | |
deploy: | |
name: CD | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ec2-user | |
key: ${{ secrets.KEY }} | |
script: | | |
sudo docker stop dc | |
sudo docker rm dc | |
sudo docker pull ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} | |
sudo docker run -d --name dc -p 8080:8080 ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} | |
sudo docker image prune -f |