Skip to content

better health check #369

better health check

better health check #369

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: build-deploy
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
branches:
[ main ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
docker-build-push:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ropc/meme-bot:latest
deploy:
needs: docker-build-push
if: ${{ github.actor == 'ropc' }}
runs-on: ubuntu-latest
steps:
- name: pull image and run updated container on remote host
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script: |
cd /home/ropc/code/meme-bot \
&& git pull --rebase \
&& docker compose -f docker-compose.yml -f docker-compose.prod.yml up \
--detach --pull always --quiet-pull --timestamps --wait \
&& docker system prune -f