File tree 7 files changed +868
-7
lines changed 7 files changed +868
-7
lines changed Original file line number Diff line number Diff line change
1
+ name : Docker
2
+
3
+ on : [pull_request]
4
+
5
+ jobs :
6
+
7
+ test :
8
+ runs-on : ubuntu-latest
9
+ name : Test
10
+ steps :
11
+ - uses : actions/checkout@v2
12
+ - name : Run tests
13
+ run : |
14
+ if [ -f docker-compose.test.yml ]; then
15
+ docker-compose --file docker-compose.test.yml build
16
+ docker-compose --file docker-compose.test.yml run sut
17
+ else
18
+ docker build . --file Dockerfile
19
+ fi
20
+
21
+
22
+
Original file line number Diff line number Diff line change
1
+ name : Docker
2
+
3
+ on : [push]
4
+
5
+ jobs :
6
+
7
+ test :
8
+ runs-on : ubuntu-latest
9
+ name : Test
10
+ steps :
11
+ - uses : actions/checkout@v2
12
+ - name : Run tests
13
+ run : |
14
+ if [ -f docker-compose.test.yml ]; then
15
+ docker-compose --file docker-compose.test.yml build
16
+ docker-compose --file docker-compose.test.yml run sut
17
+ else
18
+ docker build . --file Dockerfile
19
+ fi
20
+
21
+
22
+ deploy :
23
+ if : contains(github.repository, 'opensourceai')
24
+ name : Deploy
25
+ needs : [test]
26
+ runs-on : ubuntu-latest
27
+ steps :
28
+ - uses : actions/checkout@v2
29
+ - name : Copy file via ssh
30
+ uses : appleboy/scp-action@master
31
+ with :
32
+ host : ${{ secrets.HOST }}
33
+ username : ${{ secrets.USERNAME }}
34
+ password : ${{ secrets.PASSWORD }}
35
+ source : " ./*"
36
+ target : " /app/web/github/${{ github.repository }}/"
37
+ - name : Build and Deploy ${{ github.repository }}
38
+ uses : appleboy/ssh-action@master
39
+ with :
40
+ host : ${{ secrets.HOST }}
41
+ username : ${{ secrets.USERNAME }}
42
+ password : ${{ secrets.PASSWORD }}
43
+ overwrite : true
44
+ command_timeout : 100m
45
+ script : |
46
+ cd /app/web/github/${{ github.repository }}/
47
+ export IMAGE=${{ github.repository }}
48
+ export CONTAINER_NAME=$(echo $IMAGE | cut -d "/" -f 2)
49
+ bash ./deploy-dev.sh
50
+
51
+
Original file line number Diff line number Diff line change
1
+ FROM node:10 as base
2
+ WORKDIR /usr/src/app
3
+ COPY package*.json ./
4
+ RUN npm install --registry https://registry.npm.taobao.org
5
+ COPY . .
6
+ # EXPOSE 8080
7
+ # CMD [ "npm", "run", "serve" ]
8
+ RUN npm run build
9
+ FROM nginx as deploy
10
+ COPY --from=base /usr/src/app/build/ /usr/share/nginx/html/
11
+ COPY nginx/default.conf /etc/nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -e
3
+
4
+ docker-compose down --rmi all && docker-compose up -d --build
Original file line number Diff line number Diff line change
1
+ version : " 3"
2
+ services :
3
+ front-end :
4
+ image : ${IMAGE}:latest
5
+ container_name : ${CONTAINER_NAME}
6
+ build :
7
+ context : .
8
+ dockerfile : Dockerfile
9
+ ports :
10
+ - 8080:80
11
+
12
+
Original file line number Diff line number Diff line change
1
+ server {
2
+ listen 80;
3
+ server_name localhost;
4
+
5
+ #charset koi8-r;
6
+ access_log /var/log/nginx/host.access.log main;
7
+ error_log /var/log/nginx/error.log error;
8
+
9
+ location / {
10
+ try_files $uri $uri/ /index.html;
11
+ root /usr/share/nginx/html;
12
+ index index.html index.htm;
13
+ }
14
+
15
+ #error_page 404 /404.html;
16
+
17
+ # redirect server error pages to the static page /50x.html
18
+ #
19
+ error_page 500 502 503 504 /50x.html;
20
+ location = /50x.html {
21
+ root /usr/share/nginx/html;
22
+ }
23
+ #location /api/{
24
+ # proxy_set_header Host $host;
25
+ # proxy_set_header x-forwarded-for $remote_addr;
26
+ # proxy_set_header X-Real-IP $remote_addr;
27
+ #
28
+ # proxy_pass http://101.132.38.180:8000/;
29
+ #}
30
+ }
You can’t perform that action at this time.
0 commit comments