2023-11-02 12:12:37 +00:00
|
|
|
|
# 镜像集成
|
2024-02-06 13:01:58 +00:00
|
|
|
|
FROM node:16
|
2023-11-02 12:12:37 +00:00
|
|
|
|
|
|
|
|
|
# 设置工作区间
|
|
|
|
|
WORKDIR /xiaoju-survey
|
|
|
|
|
|
|
|
|
|
# 复制文件到工作区间
|
|
|
|
|
COPY . /xiaoju-survey
|
|
|
|
|
|
|
|
|
|
RUN npm config set registry https://registry.npmjs.org/
|
|
|
|
|
|
|
|
|
|
# 安装项目依赖
|
2023-12-28 06:31:33 +00:00
|
|
|
|
RUN cd /xiaoju-survey/web && npm install && npm run build
|
2024-02-06 13:46:49 +00:00
|
|
|
|
# 用了后端服务代理启动,建议使用nginx启动
|
2024-01-30 14:19:45 +00:00
|
|
|
|
RUN cd /xiaoju-survey && cp -af ./web/dist/* ./server/public/
|
2023-12-28 06:31:33 +00:00
|
|
|
|
|
2024-01-30 14:19:45 +00:00
|
|
|
|
RUN cd /xiaoju-survey/server && npm install && npm run build
|
2023-11-02 12:12:37 +00:00
|
|
|
|
|
2023-11-15 14:18:23 +00:00
|
|
|
|
# 暴露端口 需要跟server的port一致
|
|
|
|
|
EXPOSE 3000
|
2023-11-02 12:12:37 +00:00
|
|
|
|
|
|
|
|
|
# docker入口文件,运行pm2启动,并保证监听不断
|
|
|
|
|
CMD ["sh","docker-run.sh"]
|