Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] window11下 docker官方指导设置编译成功,docker日志无错误,端口8000可访问有404错误,开放3个端口,8080,8000,8899 #4067

Closed
ahange opened this issue Oct 9, 2024 · 8 comments
Labels
🐞 bug Something isn't working

Comments

@ahange
Copy link

ahange commented Oct 9, 2024

描述你的问题(Describe the bug)
按官方开发命令docker官方指导设置编译成功
1、docker服务器日志无错误
2、8000端口可以访问404错误
3、8080 端口、8899端口步不可以

复现路径(To Reproduce)
#docker文件

第一阶段:builder

FROM node:lts as builder

ENV WORKSPACE_DIR /workspace
ENV EXTENSION_DIR /root/.sumi/extensions
ENV EXT_MODE js
ENV NODE_ENV production

用户工作空间,用于打包到前端工作空间地址

ENV WEBIDE /app/webide

设置各种镜像和下载主机

ENV ELECTRON_MIRROR https://npmmirror.com/mirrors/electron/
ENV PUPPETEER_DOWNLOAD_HOST=https://cdn.npmmirror.com/binaries
ENV sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
ENV sharp_binary_host=https://mirrors.cloud.tencent.com/npm/sharp/-/sharp-0.31.1.tgz
ENV sentrycli_cdnurl=https://mirrors.cloud.tencent.com/npm/sentry-cli/
ENV electron_mirror=https://mirrors.cloud.tencent.com/npm/electron/
ENV chromedriver_cdnurl=https://mirrors.cloud.tencent.com/npm/chromedriver
ENV operadriver_cdnurl=https://mirrors.cloud.tencent.com/npm/operadriver
ENV python_mirror=https://pypi.tuna.tsinghua.edu.cn/simple/
ENV electron_builder_binaries_mirror=https://mirrors.cloud.tencent.com/npm/electron-builder-binaries/
ENV node_sqlite3_binary_host_mirror=https://mirrors.cloud.tencent.com/npm
ENV puppeteer_download_host=https://mirrors.cloud.tencent.com/npm
ENV sqlite3_binary_site=https://mirrors.cloud.tencent.com/npm/sqlite3/
ENV selenium_cdnurl=https://mirrors.cloud.tencent.com/npm/selenium
ENV node_inspector_cdnurl=https://mirrors.cloud.tencent.com/npm/node-inspector

创建目录

RUN mkdir -p ${WORKSPACE_DIR} &&
mkdir -p ${EXTENSION_DIR}
RUN mkdir -p ${WEBIDE}

复制所有项目文件到 ${WEBIDE}

COPY . ${WEBIDE}

WORKDIR ${WEBIDE}

配置 npm 镜像

RUN yarn config set -H npmRegistryServer "https://registry.npmmirror.com" &&
yarn --network-timeout 1000000

安装必要的库

RUN apt-get update &&
apt-get install -y --no-install-recommends
libsecret-1-dev &&
rm -rf /var/lib/apt/lists/*

设置 PKG_CONFIG_PATH 环境变量

ENV PKG_CONFIG_PATH /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig

分步执行命令并增加日志输出

RUN yarn install && echo "yarn install completed"
RUN yarn run rebuild:node && echo "yarn run rebuild:node completed"
RUN yarn run init && echo "yarn run init completed"

构建项目

RUN yarn run build && echo "yarn run build completed"
RUN yarn run download-extension && echo "yarn run download-extension completed"

第二阶段:app

FROM builder

暴露端口

EXPOSE 8080
EXPOSE 8000
EXPOSE 8899
ENV HOST 0.0.0.0

启动命令

CMD [ "yarn", "start" ]

环境信息(Environment)

第一阶段:builder

FROM node:lts as builder

ENV WORKSPACE_DIR /workspace
ENV EXTENSION_DIR /root/.sumi/extensions
ENV EXT_MODE js
ENV NODE_ENV production

用户工作空间,用于打包到前端工作空间地址

ENV WEBIDE /app/webide

设置各种镜像和下载主机

ENV ELECTRON_MIRROR https://npmmirror.com/mirrors/electron/
ENV PUPPETEER_DOWNLOAD_HOST=https://cdn.npmmirror.com/binaries
ENV sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
ENV sharp_binary_host=https://mirrors.cloud.tencent.com/npm/sharp/-/sharp-0.31.1.tgz
ENV sentrycli_cdnurl=https://mirrors.cloud.tencent.com/npm/sentry-cli/
ENV electron_mirror=https://mirrors.cloud.tencent.com/npm/electron/
ENV chromedriver_cdnurl=https://mirrors.cloud.tencent.com/npm/chromedriver
ENV operadriver_cdnurl=https://mirrors.cloud.tencent.com/npm/operadriver
ENV python_mirror=https://pypi.tuna.tsinghua.edu.cn/simple/
ENV electron_builder_binaries_mirror=https://mirrors.cloud.tencent.com/npm/electron-builder-binaries/
ENV node_sqlite3_binary_host_mirror=https://mirrors.cloud.tencent.com/npm
ENV puppeteer_download_host=https://mirrors.cloud.tencent.com/npm
ENV sqlite3_binary_site=https://mirrors.cloud.tencent.com/npm/sqlite3/
ENV selenium_cdnurl=https://mirrors.cloud.tencent.com/npm/selenium
ENV node_inspector_cdnurl=https://mirrors.cloud.tencent.com/npm/node-inspector

创建目录

RUN mkdir -p ${WORKSPACE_DIR} &&
mkdir -p ${EXTENSION_DIR}
RUN mkdir -p ${WEBIDE}

复制所有项目文件到 ${WEBIDE}

COPY . ${WEBIDE}

WORKDIR ${WEBIDE}

配置 npm 镜像

RUN yarn config set -H npmRegistryServer "https://registry.npmmirror.com" &&
yarn --network-timeout 1000000

安装必要的库

RUN apt-get update &&
apt-get install -y --no-install-recommends
libsecret-1-dev &&
rm -rf /var/lib/apt/lists/*

设置 PKG_CONFIG_PATH 环境变量

ENV PKG_CONFIG_PATH /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig

分步执行命令并增加日志输出

RUN yarn install && echo "yarn install completed"
RUN yarn run rebuild:node && echo "yarn run rebuild:node completed"
RUN yarn run init && echo "yarn run init completed"

构建项目

RUN yarn run build && echo "yarn run build completed"
RUN yarn run download-extension && echo "yarn run download-extension completed"

第二阶段:app

FROM builder

暴露端口

EXPOSE 8080
EXPOSE 8000
EXPOSE 8899
ENV HOST 0.0.0.0

启动命令

CMD [ "yarn", "start" ]
#Steps to reproduce the behavior:

  1. dockerfile放在根目录下
  2. 执行 docker run -d --name=sumi1 -p 8080:8080 -p 8000:8000 -p 8899:8899 sumi-core

预期表现(Expected behavior)

  • OS: [Windows11]
  • Browser: [e.g. chrome]
  • OpenSumi Version: [e.g. 3.4.1]
@ahange ahange added the 🐞 bug Something isn't working label Oct 9, 2024
@bytemain
Copy link
Member

bytemain commented Oct 9, 2024

你应该访问 8080

@bytemain
Copy link
Member

bytemain commented Oct 9, 2024

启动命令换成这个:yarn start:remote

@bytemain
Copy link
Member

bytemain commented Oct 9, 2024

yarn start 只监听了 localhost

@ahange
Copy link
Author

ahange commented Oct 9, 2024


reconnecting-websocket-mjs.js:527
WebSocket connection to 'ws://0.0.0.0:8000/service' failed:
  | (匿名) | @ | reconnecting-websocket-mjs.js:527 -- | -- | -- | --

yarn start 只监听了 localhost

启动命令yarn start:remote后,访问8080端口出现ws://0.0.0.0:8000/service错误

[webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.
log.js:39 [HMR] Waiting for update signal from WDS...
render-app.tsx:38 Timer 'Render' already exists
(匿名) @ render-app.tsx:38
(匿名) @ tslib.es6.mjs:121
__awaiter @ tslib.es6.mjs:117
renderApp @ render-app.tsx:36
./entry/web/app.tsx @ app.tsx:8
webpack_require @ bootstrap:22
(匿名) @ startup:6
(匿名) @ startup:6
index.js:488 [webpack-dev-server] Warnings while compiling.
logger @ index.js:488
(匿名) @ index.js:622
warn @ index.js:168
warnings @ index.js:240
(匿名) @ socket.js:62
client.onmessage @ WebSocketClient.js:45
index.js:488 [webpack-dev-server] WARNING in ../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/network.js 182:45-52
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
logger @ index.js:488
(匿名) @ index.js:622
warn @ index.js:168
warnings @ index.js:249
(匿名) @ socket.js:62
client.onmessage @ WebSocketClient.js:45
index.js:488 [webpack-dev-server] WARNING in ../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/network.js 223:45-52
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
logger @ index.js:488
(匿名) @ index.js:622
warn @ index.js:168
warnings @ index.js:249
(匿名) @ socket.js:62
client.onmessage @ WebSocketClient.js:45
index.js:488 [webpack-dev-server] WARNING in ../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/performance.js 81:88-95
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
logger @ index.js:488
(匿名) @ index.js:622
warn @ index.js:168
warnings @ index.js:249
(匿名) @ socket.js:62
client.onmessage @ WebSocketClient.js:45
index.js:488 [webpack-dev-server] WARNING in ../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/performance.js 81:116-123
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
logger @ index.js:488
(匿名) @ index.js:622
warn @ index.js:168
warnings @ index.js:249
(匿名) @ socket.js:62
client.onmessage @ WebSocketClient.js:45
index.js:488 [webpack-dev-server] WARNING in ../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/performance.js 81:139-146
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
logger @ index.js:488
(匿名) @ index.js:622
warn @ index.js:168
warnings @ index.js:249
(匿名) @ socket.js:62
client.onmessage @ WebSocketClient.js:45
index.js:484 [webpack-dev-server] Disconnected!
index.js:484 [webpack-dev-server] Trying to reconnect...
reconnecting-websocket-mjs.js:527 WebSocket connection to 'ws://0.0.0.0:8000/service' failed:
(匿名) @ reconnecting-websocket-mjs.js:527
backend.js:1 [webpack-dev-server] Warnings while compiling.
r @ backend.js:1
logger @ index.js:488
(匿名) @ index.js:622
warn @ index.js:168
warnings @ index.js:240
(匿名) @ socket.js:62
client.onmessage @ WebSocketClient.js:45
backend.js:1 [webpack-dev-server] WARNING in ../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/network.js 182:45-52
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
r @ backend.js:1
logger @ index.js:488
(匿名) @ index.js:622
warn @ index.js:168
warnings @ index.js:249
(匿名) @ socket.js:62
client.onmessage @ WebSocketClient.js:45
backend.js:1 [webpack-dev-server] WARNING in ../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/network.js 223:45-52
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
r @ backend.js:1
logger @ index.js:488
(匿名) @ index.js:622
warn @ index.js:168
warnings @ index.js:249
(匿名) @ socket.js:62
client.onmessage @ WebSocketClient.js:45
backend.js:1 [webpack-dev-server] WARNING in ../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/performance.js 81:88-95
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
r @ backend.js:1
logger @ index.js:488
(匿名) @ index.js:622
warn @ index.js:168
warnings @ index.js:249
(匿名) @ socket.js:62
client.onmessage @ WebSocketClient.js:45
backend.js:1 [webpack-dev-server] WARNING in ../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/performance.js 81:116-123
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
r @ backend.js:1
logger @ index.js:488
(匿名) @ index.js:622
warn @ index.js:168
warnings @ index.js:249
(匿名) @ socket.js:62
client.onmessage @ WebSocketClient.js:45
backend.js:1 [webpack-dev-server] WARNING in ../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/performance.js 81:139-146
Critical dependency: require function is used in a way in which dependencies cannot be statically

@ahange
Copy link
Author

ahange commented Oct 9, 2024

启动命令换成这个:yarn start:remote

替换完了,出现WebSocket connection to 'ws://0.0.0.0:8000/service' failed: 错误

@bytemain
Copy link
Member

bytemain commented Oct 9, 2024

是不是运行的时候没有加 -p 8080:8080 -p 8000:8000 -p 8899:8899

我这里完全没问题:

docker run -d --name=sumi1 -p 8080:8080 -p 8000:8000 -p 8899:8899 sumi-core

CleanShot 2024-10-09 at 14 14 20@2x

CleanShot 2024-10-09 at 14 14 23@2x

FROM node:lts as builder

# 用户工作空间,用于打包到前端工作空间地址
ENV WORKSPACE_DIR workspace
ENV EXTENSION_DIR extensions
ENV WEBIDE /app/webide

# 设置各种镜像和下载主机
ENV ELECTRON_MIRROR https://npmmirror.com/mirrors/electron/
ENV PUPPETEER_DOWNLOAD_HOST=https://cdn.npmmirror.com/binaries
ENV sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
ENV sharp_binary_host=https://mirrors.cloud.tencent.com/npm/sharp/-/sharp-0.31.1.tgz
ENV sentrycli_cdnurl=https://mirrors.cloud.tencent.com/npm/sentry-cli/
ENV electron_mirror=https://mirrors.cloud.tencent.com/npm/electron/
ENV chromedriver_cdnurl=https://mirrors.cloud.tencent.com/npm/chromedriver
ENV operadriver_cdnurl=https://mirrors.cloud.tencent.com/npm/operadriver
ENV python_mirror=https://pypi.tuna.tsinghua.edu.cn/simple/
ENV electron_builder_binaries_mirror=https://mirrors.cloud.tencent.com/npm/electron-builder-binaries/
ENV node_sqlite3_binary_host_mirror=https://mirrors.cloud.tencent.com/npm
ENV puppeteer_download_host=https://mirrors.cloud.tencent.com/npm
ENV sqlite3_binary_site=https://mirrors.cloud.tencent.com/npm/sqlite3/
ENV selenium_cdnurl=https://mirrors.cloud.tencent.com/npm/selenium
ENV node_inspector_cdnurl=https://mirrors.cloud.tencent.com/npm/node-inspector

# 创建目录
RUN mkdir -p ${WORKSPACE_DIR}  &&\
    mkdir -p ${EXTENSION_DIR}
RUN mkdir -p ${WEBIDE}

# 复制所有项目文件到${WEBIDE}
COPY . ${WEBIDE}

WORKDIR ${WEBIDE}

# 配置npm镜像
RUN yarn config set -H npmRegistryServer "https://registry.npmmirror.com" && \
    yarn --network-timeout 1000000

# 安装必要的库
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    libsecret-1-dev && \
    rm -rf /var/lib/apt/lists/*

# 设置 PKG_CONFIG_PATH 环境变量
ENV PKG_CONFIG_PATH /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig

# 分步执行命令并增加日志输出
RUN yarn install && echo "yarn install completed"
RUN yarn run rebuild:node && echo "yarn run rebuild:node completed"
RUN yarn run init && echo "yarn run init completed"

EXPOSE 8080
EXPOSE 8000
EXPOSE 8899
ENV HOST 0.0.0.0

CMD [ "yarn", "start:remote" ]

@ahange
Copy link
Author

ahange commented Oct 9, 2024

是不是运行的时候没有加 -p 8080:8080 -p 8000:8000 -p 8899:8899

我这里完全没问题:

docker run -d --name=sumi1 -p 8080:8080 -p 8000:8000 -p 8899:8899 sumi-core

CleanShot 2024-10-09 at 14 14 20@2x

CleanShot 2024-10-09 at 14 14 23@2x

FROM node:lts as builder

# 用户工作空间,用于打包到前端工作空间地址
ENV WORKSPACE_DIR workspace
ENV EXTENSION_DIR extensions
ENV WEBIDE /app/webide

# 设置各种镜像和下载主机
ENV ELECTRON_MIRROR https://npmmirror.com/mirrors/electron/
ENV PUPPETEER_DOWNLOAD_HOST=https://cdn.npmmirror.com/binaries
ENV sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
ENV sharp_binary_host=https://mirrors.cloud.tencent.com/npm/sharp/-/sharp-0.31.1.tgz
ENV sentrycli_cdnurl=https://mirrors.cloud.tencent.com/npm/sentry-cli/
ENV electron_mirror=https://mirrors.cloud.tencent.com/npm/electron/
ENV chromedriver_cdnurl=https://mirrors.cloud.tencent.com/npm/chromedriver
ENV operadriver_cdnurl=https://mirrors.cloud.tencent.com/npm/operadriver
ENV python_mirror=https://pypi.tuna.tsinghua.edu.cn/simple/
ENV electron_builder_binaries_mirror=https://mirrors.cloud.tencent.com/npm/electron-builder-binaries/
ENV node_sqlite3_binary_host_mirror=https://mirrors.cloud.tencent.com/npm
ENV puppeteer_download_host=https://mirrors.cloud.tencent.com/npm
ENV sqlite3_binary_site=https://mirrors.cloud.tencent.com/npm/sqlite3/
ENV selenium_cdnurl=https://mirrors.cloud.tencent.com/npm/selenium
ENV node_inspector_cdnurl=https://mirrors.cloud.tencent.com/npm/node-inspector

# 创建目录
RUN mkdir -p ${WORKSPACE_DIR}  &&\
    mkdir -p ${EXTENSION_DIR}
RUN mkdir -p ${WEBIDE}

# 复制所有项目文件到${WEBIDE}
COPY . ${WEBIDE}

WORKDIR ${WEBIDE}

# 配置npm镜像
RUN yarn config set -H npmRegistryServer "https://registry.npmmirror.com" && \
    yarn --network-timeout 1000000

# 安装必要的库
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    libsecret-1-dev && \
    rm -rf /var/lib/apt/lists/*

# 设置 PKG_CONFIG_PATH 环境变量
ENV PKG_CONFIG_PATH /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig

# 分步执行命令并增加日志输出
RUN yarn install && echo "yarn install completed"
RUN yarn run rebuild:node && echo "yarn run rebuild:node completed"
RUN yarn run init && echo "yarn run init completed"

EXPOSE 8080
EXPOSE 8000
EXPOSE 8899
ENV HOST 0.0.0.0

CMD [ "yarn", "start:remote" ]

就是这个命令

@ahange
Copy link
Author

ahange commented Oct 9, 2024

是不是运行的时候没有加 -p 8080:8080 -p 8000:8000 -p 8899:8899

我这里完全没问题:

docker run -d --name=sumi1 -p 8080:8080 -p 8000:8000 -p 8899:8899 sumi-core

CleanShot 2024-10-09 at 14 14 20@2x

CleanShot 2024-10-09 at 14 14 23@2x

FROM node:lts as builder

# 用户工作空间,用于打包到前端工作空间地址
ENV WORKSPACE_DIR workspace
ENV EXTENSION_DIR extensions
ENV WEBIDE /app/webide

# 设置各种镜像和下载主机
ENV ELECTRON_MIRROR https://npmmirror.com/mirrors/electron/
ENV PUPPETEER_DOWNLOAD_HOST=https://cdn.npmmirror.com/binaries
ENV sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
ENV sharp_binary_host=https://mirrors.cloud.tencent.com/npm/sharp/-/sharp-0.31.1.tgz
ENV sentrycli_cdnurl=https://mirrors.cloud.tencent.com/npm/sentry-cli/
ENV electron_mirror=https://mirrors.cloud.tencent.com/npm/electron/
ENV chromedriver_cdnurl=https://mirrors.cloud.tencent.com/npm/chromedriver
ENV operadriver_cdnurl=https://mirrors.cloud.tencent.com/npm/operadriver
ENV python_mirror=https://pypi.tuna.tsinghua.edu.cn/simple/
ENV electron_builder_binaries_mirror=https://mirrors.cloud.tencent.com/npm/electron-builder-binaries/
ENV node_sqlite3_binary_host_mirror=https://mirrors.cloud.tencent.com/npm
ENV puppeteer_download_host=https://mirrors.cloud.tencent.com/npm
ENV sqlite3_binary_site=https://mirrors.cloud.tencent.com/npm/sqlite3/
ENV selenium_cdnurl=https://mirrors.cloud.tencent.com/npm/selenium
ENV node_inspector_cdnurl=https://mirrors.cloud.tencent.com/npm/node-inspector

# 创建目录
RUN mkdir -p ${WORKSPACE_DIR}  &&\
    mkdir -p ${EXTENSION_DIR}
RUN mkdir -p ${WEBIDE}

# 复制所有项目文件到${WEBIDE}
COPY . ${WEBIDE}

WORKDIR ${WEBIDE}

# 配置npm镜像
RUN yarn config set -H npmRegistryServer "https://registry.npmmirror.com" && \
    yarn --network-timeout 1000000

# 安装必要的库
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    libsecret-1-dev && \
    rm -rf /var/lib/apt/lists/*

# 设置 PKG_CONFIG_PATH 环境变量
ENV PKG_CONFIG_PATH /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig

# 分步执行命令并增加日志输出
RUN yarn install && echo "yarn install completed"
RUN yarn run rebuild:node && echo "yarn run rebuild:node completed"
RUN yarn run init && echo "yarn run init completed"

EXPOSE 8080
EXPOSE 8000
EXPOSE 8899
ENV HOST 0.0.0.0

CMD [ "yarn", "start:remote" ]

可以了

@ahange ahange closed this as completed Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants