Skip to content

[CHORE] 채팅 기능 추가 (#23) #3

[CHORE] 채팅 기능 추가 (#23)

[CHORE] 채팅 기능 추가 (#23) #3

name: Build and Deploy
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-22.04
env:
CI: false
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.9.0'
- name: Docker build and push
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/thepopbusinessweb .
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker push ${{ secrets.DOCKER_USERNAME }}/thepopbusinessweb
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
# Stop and remove the existing container
docker stop thepopbusinessweb || true
docker rm thepopbusinessweb || true
# Remove the existing image
docker rmi ${{ secrets.DOCKER_USERNAME }}/thepopbusinessweb || true
# Pull and run the application container
docker pull ${{ secrets.DOCKER_USERNAME }}/thepopbusinessweb
docker run -d -p 80:80 --name thepopbusinessweb ${{ secrets.DOCKER_USERNAME }}/thepopbusinessweb