mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-11 07:38:45 +08:00
build:修改docker构建配置与简化后端config
This commit is contained in:
14
Dockerfile
14
Dockerfile
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user