-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (111 loc) ยท 4.07 KB
/
BackEnd.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
# name: Node.js CI
# on:
# push:
# branches: ["BE/main"]
# jobs:
# build_docker:
# # needs: test
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# with:
# context: ./back
# push: true
# tags: ghcr.io/yunuo46/was_test:latest
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: yunuo46
# password: ${{ secrets.GHCR_TOKEN }}
# - name: Build and push
# uses: docker/build-push-action@v5
# with:
# context: ./back
# push: true
# tags: ghcr.io/yunuo46/was_test:latest
# deploy_docker:
# needs: build_docker
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: SSH Version Check
# run: ssh -V
# - name: Deploy to Server via SSH
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.SERVER_HOST }}
# username: ${{ secrets.SERVER_USERNAME }}
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# port: 22
# script: |
# ssh -i ~/.ssh/id_rsa [email protected] << 'EOF'
# echo "${{ secrets.ENV_FILE }}" > .env
# echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u yunuo46 --password-stdin
# docker pull ghcr.io/yunuo46/was_test:latest
# docker stop was_test || true
# docker rm was_test || true
# docker run -d --name was_test -p 3000:3000 --env-file .env ghcr.io/yunuo46/was_test:latest
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
branches: ["BE/main"]
jobs:
build_docker:
# needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
context: ./back
push: true
tags: ghcr.io/peageon/ssock:latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: peageon
password: ${{ secrets.GHCR_TOKEN_TEST }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./back
push: true
tags: ghcr.io/peageon/ssock:latest
deploy_docker:
needs: build_docker
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: SSH Version Check
run: ssh -V
- name: Deploy to Server via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
echo "${{ secrets.ENV_FILE }}" > .env
echo ${{ secrets.GHCR_TOKEN_TEST }} | docker login ghcr.io -u peageon --password-stdin
docker pull ghcr.io/peageon/ssock:latest
docker stop ssock || true
docker rm ssock || true
docker run -d --name ssock --add-host host.docker.internal:host-gateway --restart always -p 3000:3000 --env-file .env --cpuset-cpus="0" ghcr.io/peageon/ssock:latest