Skip to content

action ec2 script add #3

action ec2 script add

action ec2 script add #3

Workflow file for this run

name: Build and Push Docker Image
on:
push:
branches: [ main ]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: jerneithe/category_service
- name: ec2 접속 및 애플리케이션 실행
uses : appleboy/ssh-action@v0.1.6
with :
host : ${{ secrets.EC2_HOST }}
username : ubuntu
key : ${{ secrets.EC2_PEMKEY }}
port : 22
script : |
sudo docker stop $(sudo docker ps -a -q)
sudo docker rm $(sudo docker ps -a -q)
sudo docker pull jerneithe/comment_service