-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (40 loc) · 1.24 KB
/
auto-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name:
on:
push:
branches:
- 'main'
jobs:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Build and Push to Docker Hub
uses: docker/build-push-action@v5
id: docker_build_client
with:
context: .
file: ./Dockerfile
builder: ${{steps.buildx.outputs.name}}
push: true
tags: dialoguebot/chatbot:latest
deploy:
runs-on: ubuntu-latest
needs: build-push
steps:
- name: executing remote ssh commands using ssh key
uses: fifsky/ssh-action@master
with:
command: |
cd /home/ubuntu
sudo docker rmi $(sudo docker images --filter "dangling=true" -q --no-trunc)
sudo docker compose pull
sudo docker compose up -d
host: ${{ secrets.HOST }}
user: ${{ secrets.USERNAME }}
pass: ${{ secrets.PASSWORD }}