Skip to content

Commit e27cbcb

Browse files
authored
Merge pull request #484 from GraphScope/update-importor
feat: update dockerfile
2 parents 18eaf02 + 9a39f64 commit e27cbcb

File tree

13 files changed

+188
-145
lines changed

13 files changed

+188
-145
lines changed

.github/workflows/docker-publish.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Publish Docker Container
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
8+
on:
9+
push:
10+
tags:
11+
- 'v*'
12+
workflow_dispatch:
13+
14+
env:
15+
# Use docker.io for Docker Hub if empty
16+
REGISTRY: ghcr.io
17+
# github.repository as <account>/<repo>
18+
IMAGE_NAME: ${{ github.repository }}
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
packages: write
26+
# This is used to complete the identity challenge
27+
# with sigstore/fulcio when running outside of PRs.
28+
id-token: write
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
# Install the cosign tool except on PR
35+
# https://github.com/sigstore/cosign-installer
36+
- name: Install cosign
37+
if: github.event_name != 'pull_request'
38+
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
39+
with:
40+
cosign-release: 'v2.2.4'
41+
42+
- name: Set up QEMU
43+
uses: docker/setup-qemu-action@v3
44+
45+
# Set up BuildKit Docker container builder to be able to build
46+
# multi-platform images and export cache
47+
# https://github.com/docker/setup-buildx-action
48+
- name: Set up Docker Buildx
49+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
50+
51+
# Login against a Docker registry except on PR
52+
# https://github.com/docker/login-action
53+
- name: Log into registry ${{ env.REGISTRY }}
54+
if: github.event_name != 'pull_request'
55+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
56+
with:
57+
registry: ${{ env.REGISTRY }}
58+
username: ${{ github.actor }}
59+
password: ${{ secrets.GITHUB_TOKEN }}
60+
61+
# Extract metadata (tags, labels) for Docker
62+
# https://github.com/docker/metadata-action
63+
- name: Extract Docker metadata
64+
id: meta
65+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
66+
with:
67+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
68+
69+
# Build and push Docker image with Buildx (don't push on PR)
70+
# https://github.com/docker/build-push-action
71+
- name: Build and push Docker image
72+
id: build-and-push
73+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
74+
with:
75+
push: ${{ github.event_name != 'pull_request' }}
76+
tags: ${{ steps.meta.outputs.tags }}
77+
labels: ${{ steps.meta.outputs.labels }}
78+
cache-from: type=gha
79+
cache-to: type=gha,mode=max
80+
platforms: linux/amd64,linux/arm64
81+
82+
# Sign the resulting Docker image digest except on PRs.
83+
# This will only write to the public Rekor transparency log when the Docker
84+
# repository is public to avoid leaking data. If you would like to publish
85+
# transparency data even for private images, pass --force to cosign below.
86+
# https://github.com/sigstore/cosign
87+
- name: Sign the published Docker image
88+
if: ${{ github.event_name != 'pull_request' }}
89+
env:
90+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
91+
TAGS: ${{ steps.meta.outputs.tags }}
92+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
93+
# This step uses the identity token to provision an ephemeral certificate
94+
# against the sigstore community Fulcio instance.
95+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

Dockerfile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ FROM node:18-alpine AS builder
44
# 设置工作目录
55
WORKDIR /app
66

7-
# 安装 Git 和 pnpm
8-
RUN apk add --no-cache git && \
9-
npm install -g pnpm
7+
# 安装 pnpm
8+
RUN npm install -g pnpm
9+
10+
# 复制当前目录的内容到容器中
11+
COPY . .
1012

1113
# 从 Git 仓库中克隆项目
12-
RUN git clone --depth=1 https://github.com/GraphScope/portal.git . && \
13-
pnpm install && \
14+
RUN pnpm install && \
1415
npm run ci
1516

1617
# 清理不必要的文件
@@ -32,15 +33,15 @@ WORKDIR /app/server
3233
# 安装proxy的依赖
3334
RUN npm install
3435

35-
# # # 设置环境变量
36-
# ENV PORT=8888
37-
# # ENV COORDINATOR=http://127.0.0.1:8080
38-
# # ENV CYPHER_ENDPOINT=neo4j://127.0.0.1:7687
39-
# # ENV GREMLIN_ENDPOINT=ws://127.0.0.1:12312/gremlin
36+
# 设置环境变量
37+
ENV PORT=8888
38+
ENV COORDINATOR=http://host.docker.internal:8080
39+
ENV CYPHER_ENDPOINT=neo4j://127.0.0.1:7687
40+
ENV GREMLIN_ENDPOINT=ws://127.0.0.1:12312/gremlin
4041

41-
# # 暴露端口
42-
# EXPOSE $PORT
42+
# 暴露端口
43+
EXPOSE $PORT
4344

4445
# 在容器启动时运行的命令
45-
# CMD ["sh", "-c", "npm run dev -- --port=${PORT} --coordinator=${COORDINATOR} --cypher_endpoint=${CYPHER_ENDPOINT} --gremlin_endpoint=${GREMLIN_ENDPOINT}"]
46+
CMD ["sh", "-c", "npm run dev -- --port=${PORT} --coordinator=${COORDINATOR} --cypher_endpoint=${CYPHER_ENDPOINT} --gremlin_endpoint=${GREMLIN_ENDPOINT}"]
4647

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,21 @@ There are two ways to start graphscope portal
2020
```bash
2121
# Pull the image
2222
docker pull registry.cn-hongkong.aliyuncs.com/graphscope/portal:latest
23+
```
24+
25+
```bash
2326
# Run the container
24-
docker run -it -p 8888:8888 --name my-portal registry.cn-hongkong.aliyuncs.com/graphscope/portal:latest
25-
# Enter the container and start the service
26-
npm run dev -- --port=8888 --coordinator=<graphscope_coordinator_endpoint> --cypher_endpoint=<graphscope_cypher_endpoint>
27+
docker run -it
28+
--name my-portal
29+
-p 8888:8888
30+
-e COORDINATOR=http://host.docker.internal:8080
31+
registry.cn-hongkong.aliyuncs.com/graphscope/portal:latest
2732
```
2833

2934
> Description of Startup Parameters
3035
31-
- `coordinator` is the address of the GraphScope engine
32-
- `port` is the frontend service port number 8888.
33-
- `cypher_endpoint` is the query address for the GraphScope Interactive engine, default is neo4j://<graphscope_cypher_endpoint>:7687
36+
- `COORDINATOR` refers to the GraphScope engine address. If you have also started the GraphScope engine locally using Docker, you can directly use `host.docker.internal:8080` as the `COORDINATOR` parameter.
37+
- `PORT` is the port number for the frontend service, defaulting to 8888.
3438

3539
### Building from the source code
3640

README.zh-CN.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,22 @@ GraphScope Portal 是一款专为 GraphScope 设计的,基于 Web 的用户交
3131
```bash
3232
# 拉取镜像
3333
docker pull registry.cn-hongkong.aliyuncs.com/graphscope/portal:latest
34+
```
35+
3436
# 运行容器
35-
docker run -it -p 8888:8888 --name my-portal registry.cn-hongkong.aliyuncs.com/graphscope/portal:latest
36-
# 进入容器,启动服务
37-
npm run dev -- --port=8888 --coordinator=<graphscope_coordinator_endpoint> --cypher_endpoint=<graphscope_cypher_endpoint>
3837

38+
```bash
39+
docker run -it
40+
--name my-portal
41+
-p 8888:8888
42+
-e COORDINATOR=http://host.docker.internal:8080
43+
registry.cn-hongkong.aliyuncs.com/graphscope/portal:latest
3944
```
4045

4146
> 启动参数说明
4247
43-
- `coordinator` 是 GraphScope 引擎地址(Interactice 和 Groot)
44-
- `port` 是前端服务端口号 `8888`.
45-
- `cypher_endpoint` 是 GraphScope Interactive 引擎的查询地址
48+
- `COORDINATOR` 是 GraphScope 引擎地址,如果你也在本地用 docker 启动了 GraphScope 引擎,可以直接使用 `host.docker.internal:8080` 作为 `COORDINATOR` 参数。
49+
- `PORT` 是前端服务端口号,默认为 `8888`.
4650

4751
### 方式二:使用源码编译(本机或者云主机都可)
4852

packages/studio-components/src/Utils/schema.js

Lines changed: 0 additions & 107 deletions
This file was deleted.

packages/studio-graph-editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"react-intl": "^6.6.1",
2828
"reactflow": "latest",
2929
"uuid": "^9.0.1",
30-
"valtio": "1.12.0",
30+
"valtio": "^1.13.2",
3131
"zustand": "^4.5.5",
3232
"react": "18.2.0",
3333
"react-dom": "18.2.0"

packages/studio-graph/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"react-dom": "18.2.0",
3939
"react-intl": "^6.6.1",
4040
"uuidv4": "latest",
41-
"valtio": "latest"
41+
"valtio": "^1.13.2"
4242
},
4343
"publishConfig": {
4444
"access": "public"

packages/studio-graph/src/components/ContextMenu/NeighborQuery/index.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,29 @@ const CommonNeighbor: React.FunctionComponent<INeighborQueryProps> = props => {
4141
};
4242
});
4343

44+
const extraItems =
45+
relatedEdges.length > 1
46+
? [
47+
{
48+
key: `(a)-[b]-(c)`,
49+
label: `All Neighbors`,
50+
},
51+
]
52+
: [];
4453
const items = [
4554
{
4655
key: 'NeighborQuery',
4756
// icon: <ShareAltOutlined />,
4857
label: 'NeighborQuery',
49-
children: itemChildren,
58+
children: [...extraItems, ...itemChildren],
5059
},
5160
];
5261

5362
const onClick = async ({ key }) => {
5463
emitter?.emit('canvas:click');
64+
updateStore(draft => {
65+
draft.isLoading = true;
66+
});
5567
const { name, title } = selectNode.properties;
5668
let script = '';
5769
if (name) {
@@ -84,9 +96,13 @@ const CommonNeighbor: React.FunctionComponent<INeighborQueryProps> = props => {
8496
draft.dataMap = getDataMap(newData);
8597
draft.nodeStatus = nodeStatus;
8698
draft.edgeStatus = edgeStatus;
99+
draft.isLoading = false;
87100
});
88101
}
89102
};
103+
if (itemChildren.length === 0) {
104+
return null;
105+
}
90106
return (
91107
<div ref={MenuRef}>
92108
<Menu

packages/studio-importor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"reactflow": "latest",
3333
"sql-ddl-to-json-schema": "latest",
3434
"uuidv4": "^6.2.13",
35-
"valtio": "^1.12.1"
35+
"valtio": "^1.13.2"
3636
},
3737
"devDependencies": {
3838
"@types/d3-force": "latest",

packages/studio-query/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"@antv/g2": "5.1.13",
3737
"uuid": "^9.0.1",
3838
"dayjs": "^1.11.10",
39-
"valtio": "^1.12.1",
39+
"valtio": "^1.13.2",
4040
"@graphscope/_test_gremlin_": "^0.1.2",
4141
"neo4j-driver": "^5.12.0",
4242
"monaco-editor": "^0.50.0"

0 commit comments

Comments
 (0)