Skip to content

Commit 9782aa0

Browse files
Merge pull request #390 from longxiaofei/master
chore: update docker-compose.yml
2 parents 9c5b613 + 01d5cbf commit 9782aa0

File tree

9 files changed

+127
-12
lines changed

9 files changed

+127
-12
lines changed

.dockerignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
/server/dataset/
26+
27+
.vscode
28+
29+
safety
30+
dist
31+
32+
coverage
33+
34+
.cache
35+
.eslintcache
36+
37+
*.cert
38+
*.key
39+
*.pem
40+
41+
packages/frontend/public/datasets/*
42+
43+
*service.json
44+
*.db
45+
46+
for_test/
47+
sasl-0.3.1-cp310-cp310-win_amd64.whl
48+
__pycache__/
49+
.idea/
50+
connect.db
51+
not_sqlalchemy/
52+
run_flask_app.bat
53+
venv
54+
55+
dataset-with-metas.json

client.dockerfile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
FROM node:16 as build-stage
1+
FROM node:16 AS build-stage
2+
23
COPY . /app
4+
35
WORKDIR /app
4-
ENV NODE_OPTIONS=--max_old_space_size=4096
5-
RUN npm config set registry https://registry.npmmirror.com
6-
RUN yarn config set registry https://registry.npmmirror.com
6+
77
RUN yarn install
8-
RUN yarn workspace rath-client build2
98

10-
FROM nginx:latest
11-
COPY --from=build-stage /app/packages/rath-client/build /usr/share/nginx/html
12-
CMD ["nginx", "-g", "daemon off;"]
9+
RUN yarn workspace rath-client buildOnDocker
10+
11+
FROM nginx:1.24
12+
13+
COPY --from=node-builder /app/packages/rath-client/build /usr/share/nginx/html
14+
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
15+
16+
ENTRYPOINT ["nginx", "-g", "daemon off;"]

docker-compose.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1+
version: "2"
2+
13
services:
2-
frontend:
4+
base:
5+
restart: always
36
build:
47
context: .
58
dockerfile: client.dockerfile
69
ports:
7-
- 8080:80
10+
- 9083:80
11+
12+
connector-api:
13+
restart: always
14+
network_mode: service:base
15+
build:
16+
context: ./services/connector
17+
dockerfile: Dockerfile
18+
19+
prediction-api:
20+
restart: always
21+
network_mode: service:base
22+
build:
23+
context: ./services/prediction
24+
dockerfile: Dockerfile

docker/nginx.conf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
location / {
6+
root /usr/share/nginx/html;
7+
index index.html index.htm;
8+
}
9+
10+
error_page 500 502 503 504 /50x.html;
11+
location = /50x.html {
12+
root /usr/share/nginx/html;
13+
}
14+
15+
location /connector/api {
16+
proxy_pass http://localhost:5001/api;
17+
}
18+
19+
location /api/train_test {
20+
proxy_pass http://localhost:5533/api/train_test;
21+
}
22+
23+
}

packages/rath-client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"build:renderer": "yarn workspace vega-painter-renderer build",
8181
"start": "react-app-rewired start",
8282
"build": "npm run build:utils && npm run build:scenegraph && npm run build:renderer && npm run build:client",
83+
"buildOnDocker": "npm run build:utils && npm run build:scenegraph && npm run build:renderer && GENERATE_SOURCEMAP=false react-app-rewired --max_old_space_size=4096 build",
8384
"build:client": "GENERATE_SOURCEMAP=false react-app-rewired --max_old_space_size=8000 build",
8485
"buildForAnalysis": "react-app-rewired build",
8586
"test": "jest -c ./jest.config.js --passWithNoTests --no-cache",

packages/rath-client/src/pages/causal/predict.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export interface IPredictResult {
5151
const PREDICT_API_KEY = 'prediction_service';
5252
function getPredictAPIPath (path = "/api/train_test") {
5353
const baseURL = new URL(window.location.href);
54-
const serviceURL = new URL(baseURL.searchParams.get(PREDICT_API_KEY) || localStorage.getItem(PREDICT_API_KEY) || "http://127.0.0.1:5533/api/train_test");
54+
const serviceURL = new URL(baseURL.searchParams.get(PREDICT_API_KEY) || localStorage.getItem(PREDICT_API_KEY) || window.location.href);
5555
serviceURL.pathname = path;
5656
return serviceURL.toString();
5757
}

packages/rath-client/src/pages/dataConnection/database/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ interface DatabaseDataProps {
6868
export const inputWidth = '180px';
6969

7070
export const defaultServers: readonly string[] = [
71+
"/connector",
7172
'https://gateway.kanaries.net/connector',
72-
'https://kanaries.cn/connector',
7373
];
7474

7575
const MAX_SERVER_COUNT = 5;

services/prediction/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM python:3.10.7
2+
3+
WORKDIR /prediction
4+
5+
COPY . /prediction
6+
7+
RUN pip3 install --trusted-host pypi.python.org -r requirements.txt
8+
9+
CMD python3 -u /prediction/main.py

services/prediction/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Flask
2+
Flask_cors
3+
gevent
4+
scikit-learn==1.3.0
5+
xgboost==1.7.6
6+
pandas==2.0.3

0 commit comments

Comments
 (0)