This commit is contained in:
aaron 2025-03-12 09:49:56 +08:00
parent 08e863de8a
commit 8ed9e8e176

View File

@ -19,15 +19,22 @@ ENV BUILD_TIMESTAMP=${BUILD_TIMESTAMP}
RUN echo "Building for environment: ${NODE_ENV}"
RUN echo "Build timestamp: ${BUILD_TIMESTAMP}"
# 安装 pnpm
RUN npm install -g pnpm
# 设置 pnpm 镜像
RUN pnpm config set registry http://mirrors.cloud.tencent.com/npm/
# 复制依赖文件
COPY package.json ./
RUN npm config set registry http://mirrors.cloud.tencent.com/npm/
# 安装依赖
RUN npm install && \
RUN pnpm install && \
echo "Installed dependencies:" && \
npm list --depth=0 | grep -E '@babel|webpack|vue'
pnpm list -g
# 安装 webpack 和 babel 相关依赖
RUN pnpm add -D webpack webpack-cli webpack-dev-server @babel/core @babel/preset-env babel-loader
# 确保babel配置文件存在
RUN echo '{ "presets": ["@babel/preset-env"] }' > .babelrc
@ -39,7 +46,7 @@ COPY . .
RUN echo "VUE_APP_API_URL=${API_URL:-/api}" > .env.production
# 构建应用
RUN npm run build
RUN pnpm run build
# 生产阶段
FROM nginx:stable-alpine as production-stage