From 4c3bbddf5baa4cda221131d16dab84924529f29c Mon Sep 17 00:00:00 2001 From: sudoooooo Date: Wed, 15 Nov 2023 22:18:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DDocker=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 20 +++++--------------- server/package.json | 2 +- web/public/management.html | 2 +- web/public/render.html | 3 +-- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index c08e3f54..ddeffbad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ No newline at end of file diff --git a/server/package.json b/server/package.json index ce7dc001..7406d788 100644 --- a/server/package.json +++ b/server/package.json @@ -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", diff --git a/web/public/management.html b/web/public/management.html index 86628615..624e33da 100644 --- a/web/public/management.html +++ b/web/public/management.html @@ -9,7 +9,7 @@
diff --git a/web/public/render.html b/web/public/render.html index afd01ecd..904b2bde 100644 --- a/web/public/render.html +++ b/web/public/render.html @@ -44,8 +44,7 @@