16 lines
465 B
Docker
Raw Normal View History

2025-08-10 23:09:36 +08:00
# 使用 node 构建阶段
FROM node:22 AS builder
WORKDIR /app
COPY . .
RUN npm install && npm run build
# 使用 nginx 作为生产环境
FROM nginx:stable-alpine
COPY --from=builder /app/dist /usr/share/nginx/html
# 设置静态资源的访问权限,避免 403 Forbidden
RUN find /usr/share/nginx/html -type f -exec chmod 644 {} \; \
&& find /usr/share/nginx/html -type d -exec chmod 755 {} \;
COPY nginx.conf /etc/nginx/conf.d/default.conf