2023-11-02 12:12:37 +00:00
|
|
|
# 镜像集成
|
2024-05-20 10:37:12 +00:00
|
|
|
FROM node:18
|
2023-11-02 12:12:37 +00:00
|
|
|
|
|
|
|
# 设置工作区间
|
|
|
|
WORKDIR /xiaoju-survey
|
|
|
|
|
|
|
|
# 复制文件到工作区间
|
|
|
|
COPY . /xiaoju-survey
|
|
|
|
|
2024-04-29 10:00:29 +00:00
|
|
|
# 安装nginx
|
2024-05-20 12:18:59 +00:00
|
|
|
RUN apt-get update && apt-get install -y nginx
|
2024-04-29 10:00:29 +00:00
|
|
|
|
2023-11-02 12:12:37 +00:00
|
|
|
RUN npm config set registry https://registry.npmjs.org/
|
|
|
|
|
|
|
|
# 安装项目依赖
|
2024-05-20 12:18:59 +00:00
|
|
|
RUN cd /xiaoju-survey/web && npm install && npm run build-only
|
2024-05-20 10:37:12 +00:00
|
|
|
|
2024-04-29 10:00:29 +00:00
|
|
|
# 覆盖nginx配置文件
|
|
|
|
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
|
2023-12-27 11:29:20 +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
|
|
|
|
2024-04-29 10:00:29 +00:00
|
|
|
# 暴露端口 需要跟nginx的port一致
|
2024-05-20 10:37:12 +00:00
|
|
|
EXPOSE 80
|
2023-11-02 12:12:37 +00:00
|
|
|
|
2024-04-29 10:00:29 +00:00
|
|
|
# docker入口文件,启动nginx和运行pm2启动,并保证监听不断
|
2023-11-02 12:12:37 +00:00
|
|
|
CMD ["sh","docker-run.sh"]
|