-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.web
More file actions
32 lines (23 loc) · 961 Bytes
/
Copy pathDockerfile.web
File metadata and controls
32 lines (23 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# ============================================================
# 阶段一:构建 - 编译 TypeScript 并通过 Vite 打包
# ============================================================
FROM node:22-alpine AS build
WORKDIR /app
COPY web/package.json web/package-lock.json ./
RUN npm ci
COPY web/ .
# 使用相对路径 /api/v1 - Nginx 将代理到后端
ENV VITE_API_BASE_URL=""
ENV VITE_APP_NAME="RustCloud"
RUN npm run build
# ============================================================
# 阶段二:运行时 - 使用 Nginx 提供服务
# ============================================================
FROM nginx:1.27-alpine AS runtime
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1
CMD ["nginx", "-g", "daemon off;"]