-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (28 loc) · 898 Bytes
/
main.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
name: Docker Build and Deploy
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build_and_deploy:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: SSH into Server, Pull Changes, and Build Docker Image
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd ${{ secrets.WORK_DIR }}
git pull origin main
docker build -t kemistry .
docker tag kemistry:latest kevinkoech357/kemistry:latest
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker push kevinkoech357/kemistry:latest
- name: Cleanup
run: rm -f ~/.ssh/id_rsa ~/.ssh/known_hosts