build:修改docker构建配置与简化后端config

This commit is contained in:
jiangrui
2025-03-06 18:24:01 +08:00
parent e708524a41
commit e8f70b286e
7 changed files with 72 additions and 70 deletions

View File

@@ -26,6 +26,9 @@ RUN apk add --no-cache nginx
# 设置工作目录
WORKDIR /app
# 创建配置和数据目录
RUN mkdir -p /app/config /app/data
# 复制前端构建产物到 Nginx
COPY --from=frontend-build /app/dist /usr/share/nginx/html
@@ -38,8 +41,15 @@ COPY --from=backend-build /app /app
# 安装生产环境依赖
RUN npm install --production
# 设置数据卷
VOLUME ["/app/config", "/app/data"]
# 暴露端口
EXPOSE 8008
# 启动 Nginx 和后端服务
CMD ["sh", "-c", "nginx -g 'daemon off;' & npm run start && wait"]
# 启动脚本
COPY docker-entrypoint.sh /app/
RUN chmod +x /app/docker-entrypoint.sh
# 启动服务
ENTRYPOINT ["/app/docker-entrypoint.sh"]