This commit is contained in:
toom1996
2026-09-29 19:59:22 +08:00
parent b4fa41338b
commit 335e264e45
12 changed files with 143 additions and 103 deletions

View File

@ -23,9 +23,15 @@ RUN npm ci
COPY . .
RUN npm run build
# ---- 静态托管阶段 ----
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
# ---- 运行阶段 ----
# 前端以 @astrojs/node standalone server 运行(监听 3000),nginx 反代 / 到该端口、
# 反代 /api 到 backend:8090。这样 on-demand SSR 详情页 / sitemap / robots 才能正确产出 HTML。
FROM node:22-alpine
RUN apk add --no-cache nginx
WORKDIR /app
COPY --from=build /app/dist ./dist
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
ENTRYPOINT ["/entrypoint.sh"]