-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (31 loc) · 997 Bytes
/
cd.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: Backend CD
on:
push:
branches: [ "develop" ]
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set env
run: |
mkdir envs
echo "DB_HOST=${{ secrets.DB_HOST }}" >> envs/prod.env
echo "DB_PORT=${{ secrets.DB_PORT }}" >> envs/prod.env
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> envs/prod.env
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> envs/prod.env
echo "DB_DATABASE=${{ secrets.DB_DATABASE }}" >> envs/prod.env
- name: Build docker image
run: docker build . -t rankin:latest
deploy:
needs: build
runs-on: self-hosted
steps:
- name: Stop docker
run: |
docker stop rankin && docker rm rankin
- name: Run docker
if: always()
run: |
docker run --name rankin -d -p 3000:3000 -v /var/rankin/logs:/app/logs rankin:latest