2026-06-05 02:13:49 +08:00
|
|
|
# =============================================================================
|
|
|
|
|
# Build stage
|
|
|
|
|
# =============================================================================
|
|
|
|
|
FROM node:20-alpine AS builder
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
COPY package.json pnpm-lock.yaml ./
|
|
|
|
|
RUN npm install -g pnpm && pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
|
|
COPY . .
|
2026-07-24 03:28:29 +08:00
|
|
|
ENV VITE_API_URL=/api
|
2026-06-05 02:13:49 +08:00
|
|
|
RUN pnpm run build
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
# Production stage
|
|
|
|
|
# =============================================================================
|
|
|
|
|
FROM nginx:alpine AS production
|
|
|
|
|
|
2026-07-24 03:28:29 +08:00
|
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
2026-06-05 02:13:49 +08:00
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
2026-07-24 03:28:29 +08:00
|
|
|
CMD wget --no-redirect --quiet --tries=1 --spider http://localhost/ || exit 1
|