Files
WeKnora/frontend/Dockerfile
T
DuYunfanandClaude Opus 4.7 16d31cb87b fix(frontend): use npm to match committed lockfile
The Dockerfile invoked corepack + pnpm install, but the repo only
ships package-lock.json (no pnpm-lock.yaml). On node:24-alpine
corepack resolves to pnpm v10, whose default --strict-dep-builds
rejects unbuilt postinstall scripts (esbuild, vue-demi,
@vue-office/pptx) and aborts with ERR_PNPM_IGNORED_BUILDS, breaking
docker compose build.

Switching to npm ci / npm run build aligns the image build with
CLAUDE.md and the local dev workflow that already uses npm.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 20:10:04 +08:00

43 lines
883 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 构建阶段
FROM node:24-alpine AS build-stage
WORKDIR /app
# 设置环境变量,忽略类型检查错误
ENV NODE_OPTIONS="--max-old-space-size=4096"
ENV VITE_IS_DOCKER=true
# 复制依赖文件
COPY package*.json ./
COPY pnpm-workspace.yaml ./
COPY packages/xlsx-0.20.2.tgz ./packages/xlsx-0.20.2.tgz
# 安装依赖
RUN npm ci
# 复制项目文件
COPY . .
# 构建应用
RUN npm run build
# 生产阶段
FROM nginx:stable-alpine AS production-stage
# 复制构建产物到nginx服务目录
COPY --from=build-stage /app/dist /usr/share/nginx/html
# 复制nginx配置模板文件
COPY nginx.conf /etc/nginx/templates/default.conf.template
# 复制启动脚本
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
# 设置默认环境变量(MB
ENV MAX_FILE_SIZE_MB=50
# 暴露端口
EXPOSE 80
ENTRYPOINT ["/docker-entrypoint.sh"]