File tree 1 file changed +50
-0
lines changed
1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Deploy to Server
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+
8
+ jobs :
9
+ deploy :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ - name : Checkout code
14
+ uses : actions/checkout@v2
15
+
16
+ - name : Set up SSH
17
+ uses : webfactory/ssh-agent@v0.5.3
18
+ with :
19
+ ssh-private-key : ${{ secrets.SSH_PRIVATE_KEY }}
20
+
21
+ # - name: Update packages
22
+ # run: |
23
+ # sudo apt-get update -y
24
+ # sudo apt-get upgrade -y
25
+
26
+ - name : Remove conflicting packages
27
+ run : |
28
+ sudo apt-get remove -y containerd
29
+ sudo apt-get clean
30
+ sudo apt-get update
31
+ sudo apt-get autoremove -y
32
+ sudo apt-get install -y containerd.io
33
+
34
+
35
+
36
+ - name : Build and push Docker image
37
+ run : |
38
+ docker build -t docker-test-angular .
39
+ docker login -u 10449 -p ${{ secrets.DOCKERHUB_TOKEN }}
40
+ docker tag docker-test 10449/docker-test-angular
41
+ docker push 10449/docker-test-angular
42
+
43
+ - name : Disable strict host key checking
44
+ run : echo "StrictHostKeyChecking no" >> ~/.ssh/config
45
+
46
+ - name : SSH into server and deploy
47
+ run : |
48
+ ssh root@61.97.102.90 'docker pull 10449/docker-test-angular && docker run -d -p 5200:5200 10449/docker-test-angular'
49
+ # ssh root@95.130.227.6 "docker pull 10449/docker-test && docker-compose up -d"
50
+
You can’t perform that action at this time.
0 commit comments