# syntax=docker/dockerfile:1.7 # 构建 Vite 前端产物。 FROM oven/bun:1.3.13 AS web-build WORKDIR /app/web COPY web/package.json web/bun.lock ./ RUN --mount=type=cache,target=/root/.bun/install/cache bun install --cache-dir=/root/.bun/install/cache COPY VERSION /app/VERSION COPY CHANGELOG.md /app/CHANGELOG.md COPY web ./ RUN bun run build # 运行镜像:nginx 托管静态前端,并在 Compose 中把 /api 转发到后端服务。 FROM nginx:1.27-alpine COPY --from=web-build /app/web/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 CMD wget -qO- http://127.0.0.1:3000/ >/dev/null || exit 1