-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
47 lines (33 loc) · 1.07 KB
/
Dockerfile
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
# 第一阶段:从 Git 克隆完整项目并构建
FROM node:18-alpine AS builder
# 设置工作目录
WORKDIR /app
# 安装 pnpm
RUN npm install -g pnpm
# 复制当前目录的内容到容器中
COPY . .
# 从 Git 仓库中克隆项目
RUN pnpm install && \
npm run build:portal:less
# 清理不必要的文件
RUN rm -rf .git
# 第二阶段:仅复制前端产物到最终镜像中
FROM node:18-alpine
# 设置工作目录
WORKDIR /app
# 复制前端产物到最终镜像
COPY --from=builder /app/packages/studio-website/dist dist/
COPY --from=builder /app/packages/studio-website/server server/
# 进入proxy目录
WORKDIR /app/server
# 安装proxy的依赖
RUN npm install
# 设置环境变量
ENV PORT=8888
ENV COORDINATOR=http://host.docker.internal:8080
ENV CYPHER_ENDPOINT=neo4j://127.0.0.1:7687
ENV GREMLIN_ENDPOINT=ws://127.0.0.1:12312/gremlin
# 暴露端口
EXPOSE $PORT
# 在容器启动时运行的命令
CMD ["sh", "-c", "npm run dev -- --port=${PORT} --coordinator=${COORDINATOR} --cypher_endpoint=${CYPHER_ENDPOINT} --gremlin_endpoint=${GREMLIN_ENDPOINT}"]