Skip to content

Deploy

Deploy #7

Workflow file for this run

name: Deploy
on: workflow_dispatch
jobs:
deploy:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push bbot app image
uses: docker/build-push-action@v5
with:
context: .
file: ./.docker/app/Dockerfile
push: true
tags: bifidokk/whisper-bot-app:latest
- name: Build and push migration image
uses: docker/build-push-action@v5
with:
context: .
file: ./.docker/migrations/Dockerfile
push: true
tags: bifidokk/whisper-bot-migrations:latest
- name: Restart Docker compose with fresh images
uses: appleboy/ssh-action@v0.1.10
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script_stop: true
script: |
cd /var/www/whisper-bot
git pull
docker image prune --all --force
docker compose --file ./.docker/docker-compose.yml --env-file ./.docker/.env.prod pull
docker compose --file ./.docker/docker-compose.yml --env-file ./.docker/.env.prod down
docker compose --file ./.docker/docker-compose.yml --env-file ./.docker/.env.prod up -d