Skip to content

Merge pull request #35 from hackathon-Vink-Team-3/dev #3

Merge pull request #35 from hackathon-Vink-Team-3/dev

Merge pull request #35 from hackathon-Vink-Team-3/dev #3

Workflow file for this run

name: deploy workflow
on:
push:
branches:
- main
jobs:
build_and_push_to_docker_hub:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./chat_bot/
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/vink-backend:latest
deploy:
runs-on: ubuntu-latest
needs:
- build_and_push_to_docker_hub
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Executing remote ssh commands to deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
script: |
cd ${{ secrets.PATH_TO_REPO }}
git checkout main
git pull
sudo docker compose -f docker-compose.yml pull
sudo docker compose -f docker-compose.yml down
sudo docker compose -f docker-compose.yml up -d