delete(filter): any, http #38
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: Distribute | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
distribute: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
cache: 'yarn' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker images backend api | |
run: | | |
docker build -t siontama/lifepoo:latest . --platform linux/x86_64 | |
docker push siontama/lifepoo:latest | |
- name: Deploy lifepoo | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
port: ${{ secrets.SERVER_PORT }} | |
key: ${{ secrets.SERVER_KEY}} | |
timeout: 60s | |
script: | | |
cd ~/LifePoop_Server | |
docker pull siontama/lifepoo:latest | |
docker-compose stop api | |
# docker-compose start api # 기존 이미지로 서버가 뜸 | |
docker-compose up -d api | |
docker image prune -f # 이미지가 업데이트 되었으므로 이전 이미지 삭제 |