Skip to content

feat: Channel Talk Webhook test 2 #7

feat: Channel Talk Webhook test 2

feat: Channel Talk Webhook test 2 #7

Workflow file for this run

name: Deploy to EC2
on:
push:
branches:
["dev"]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- uses: mr-smithers-excellent/docker-build-push@v6 # Docker Image Build
name: Build & push Docker image
with:
image: invalidid56/komin
tags: komin, latest
registry: docker.io
dockerfile: Dockerfile
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: create remote directory # ec2 서버에 디렉토리를 하나 만들어준다.
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
mkdir -p /home/ubuntu/srv/ubuntu
docker stop $(docker ps -a -q)
- name: copy source via ssh key # ssh key를 이용해 현재 푸시된 소스를 서버에 복사한다.
uses: burnett01/rsync-deployments@4.1
with:
switches: -avzr --delete
remote_path: /home/ubuntu/srv/ubuntu/
remote_host: ${{ secrets.HOST }}
remote_user: ubuntu
remote_key: ${{ secrets.KEY }}
- name: executing remote ssh commands using password # TODO: 서버에 접속하여 Docker image pull 및 컨테이너 시작
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
docker pull invalidid56/komin
docker run -d -p 80:8000 invalidid56/komin