fix: 修复Docker启动问题

This commit is contained in:
sudoooooo 2023-11-15 22:18:23 +08:00
parent 0fda6cdc0c
commit 4c3bbddf5b
4 changed files with 8 additions and 19 deletions

View File

@ -2,7 +2,7 @@
FROM ubuntu:latest
# 安装依赖
RUN apt-get -y update
RUN apt-get -y update
RUN apt-get -y install wget gcc
# 安装node环境
@ -22,24 +22,14 @@ RUN npm config set registry https://registry.npmjs.org/
# 安装项目依赖
RUN cd /xiaoju-survey/web && npm install
RUN cd /xiaoju-survey/server && sh init.sh
RUN cd /xiaoju-survey/server && npm install
# 构建项目,并把产物推送到服务公共目录
RUN cd /xiaoju-survey/web && npm run build
RUN cd /xiaoju-survey && cp -af ./web/dist/ ./server/src/apps/ui/public/
RUN cd /xiaoju-survey && cp -af ./web/dist/* ./server/src/apps/ui/public/
# 暴露端口
EXPOSE 8080
# 暴露端口 需要跟server的port一致
EXPOSE 3000
# docker入口文件,运行pm2启动,并保证监听不断
CMD ["sh","docker-run.sh"]
# 构建镜像
# docker build -t xiaoju-survey-app .
# 运行容器
# docker run --rm --name running-xiaoju-survey-app -p 8080:8080 xiaoju-survey-app
# 进入容器
# docker exec -it running-xiaoju-survey-app bash
# 停止容器
# docker stop running-xiaoju-survey-app
# 查看日志
# docker logs running-xiaoju-survey-app

View File

@ -4,7 +4,7 @@
"description": "survey server template",
"main": "index.js",
"scripts": {
"copy": "cp -rf ./src/ ./build/",
"copy": "cp -rf ./src/* ./build/",
"build": "tsc",
"launch:local": "npm run build && SERVER_ENV=local node ./build/index.js",
"launch:dev": "npm run build && SERVER_ENV=dev node ./build/index.js",

View File

@ -9,7 +9,7 @@
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
<strong><%= htmlWebpackPlugin.options.title %>页面不允许执行JavaScript请修改设置</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->

View File

@ -44,8 +44,7 @@
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
<strong> <%= htmlWebpackPlugin.options.title %>页面不允许执行JavaScript请修改设置</strong>
</noscript>
<div id="app"></div>
</body>