hotfix replace EC2 instance #150
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: Docker Image CI | |
on: | |
pull_request: | |
branches: ['main'] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
- name: build and release to DockerHub | |
env: | |
NAME: yeobi # 계정 명 | |
REPO: morandi-frontend # 레포 이름 | |
run: | | |
docker build -t $REPO . | |
docker tag $REPO:latest $NAME/$REPO:latest | |
docker push $NAME/$REPO:latest | |
- name: SSH into AWS EC2 instance | |
uses: appleboy/ssh-action@master | |
with: | |
host: 10.0.128.33 | |
username: ubuntu | |
key: ${{ secrets.AWS_SSH_PRIVATE_KEY }} | |
proxy_host: 3.35.14.92 | |
proxy_username: ubuntu | |
proxy_key: ${{ secrets.AWS_SSH_PRIVATE_KEY }} | |
# 아래 내용을 실행하여 Docker 이미지를 내려받고 실행 | |
script: | | |
./deploy-frontend.sh |