You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# scripts/Dockerfile
|
|
|
|
|
|
|
|
FROM node:20-slim AS builder
|
|
|
|
|
|
|
|
ENV PNPM_HOME="/pnpm"
|
|
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
|
|
ENV NODE_OPTIONS=--max-old-space-size=8192
|
|
|
|
ENV TZ=Asia/Shanghai
|
|
|
|
|
|
|
|
RUN npm install -g pnpm@10.7.0
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
ENV COREPACK_ENABLE_UNSAFE_CUSTOM_URLS=1
|
|
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
|
|
|
RUN pnpm run build --filter=\!./docs
|
|
|
|
|
|
|
|
RUN echo "Builder Success 🎉"
|
|
|
|
|
|
|
|
FROM nginx:stable-alpine AS production
|
|
|
|
|
|
|
|
# 支持 .mjs 类型
|
|
|
|
RUN echo "types { application/javascript js mjs; }" > /etc/nginx/conf.d/mjs.conf
|
|
|
|
|
|
|
|
# 拷贝构建产物
|
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
|
|
|
|
# 拷贝 nginx 配置
|
|
|
|
COPY --from=builder /app/scripts/nginx.conf /etc/nginx/nginx.conf
|
|
|
|
|
|
|
|
EXPOSE 5000
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|