-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (35 loc) · 1.07 KB
/
deploy.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
41
name: Deploy to Linode
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Log Docker Hub Credentials
run: |
echo "Docker Hub Username: ${{ secrets.DOCKER_HUB_USERNAME }}"
echo "Docker Hub Password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}"
- name: Build and Push Docker image
run: |
docker build -t xeera/prag .
docker push xeera/prag
- name: Deploy to Linode
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.LINODE_IP }}
username: ${{ secrets.LINODE_USERNAME }}
key: ${{ secrets.LINODE_SSH_KEY }}
script: |
docker pull xeera/prag
docker stop prag || true
docker rm prag || true
docker run -d --name prag -p 80:8501 xeera/prag