Compare commits

..

4 Commits

Author SHA1 Message Date
yuliang_guo
3bc9304fa9 chore: trigger rebuild [all]
Some checks are pending
continuous-integration/drone/push Build is running
2026-02-03 18:32:59 +08:00
yuliang_guo
a2ba73e33d fix: 增加 Node.js 内存限制避免构建 OOM
Some checks are pending
continuous-integration/drone/push Build is running
2026-02-03 18:02:57 +08:00
yuliang_guo
bb669ef422 fix: npm install 添加 --include=dev 确保安装 vite
Some checks failed
continuous-integration/drone/push Build is failing
2026-02-03 17:56:42 +08:00
yuliang_guo
44beaa164d fix: 前端构建添加 --target production 参数
Some checks failed
continuous-integration/drone/push Build is failing
2026-02-03 17:53:05 +08:00
2 changed files with 7 additions and 5 deletions

View File

@@ -48,7 +48,7 @@ steps:
commands:
- echo "$DOCKER_PASSWORD" | docker login "$DOCKER_REGISTRY" -u "$DOCKER_USERNAME" --password-stdin
- cd frontend
- docker build -t $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:test -f Dockerfile --build-arg VITE_API_BASE_URL=https://kpl.ireborn.com.cn .
- docker build -t $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:test -f Dockerfile --target production --build-arg VITE_API_BASE_URL=https://kpl.ireborn.com.cn .
- docker tag $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:test $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:${DRONE_COMMIT_SHA:0:8}
- docker push $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:test
- docker push $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:${DRONE_COMMIT_SHA:0:8}
@@ -105,7 +105,7 @@ steps:
commands:
- echo "$DOCKER_PASSWORD" | docker login "$DOCKER_REGISTRY" -u "$DOCKER_USERNAME" --password-stdin
- cd frontend
- docker build -t $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:staging -f Dockerfile --build-arg VITE_API_BASE_URL=https://aiedu.ireborn.com.cn .
- docker build -t $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:staging -f Dockerfile --target production --build-arg VITE_API_BASE_URL=https://aiedu.ireborn.com.cn .
- docker push $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:staging
volumes:
@@ -161,7 +161,7 @@ steps:
commands:
- echo "$DOCKER_PASSWORD" | docker login "$DOCKER_REGISTRY" -u "$DOCKER_USERNAME" --password-stdin
- cd frontend
- docker build -t $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:main -f Dockerfile --build-arg VITE_API_BASE_URL=https://hua.ireborn.com.cn .
- docker build -t $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:main -f Dockerfile --target production --build-arg VITE_API_BASE_URL=https://hua.ireborn.com.cn .
- docker tag $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:main $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:latest
- docker push $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:main
- docker push $DOCKER_REGISTRY/ireborn/kaopeilian-frontend:latest

View File

@@ -28,7 +28,8 @@ COPY package*.json ./
RUN npm config set registry https://registry.npmmirror.com
# 安装所有依赖包括开发依赖跳过husky
RUN npm install --silent --ignore-scripts
# 注意NODE_ENV=production 会跳过 devDependencies所以用 --include=dev
RUN npm install --silent --ignore-scripts --include=dev
# 复制源代码
COPY . .
@@ -43,7 +44,8 @@ RUN echo "======================================" && \
echo "======================================"
# 构建应用使用环境变量中的API地址
RUN npm run build
# 增加 Node.js 内存限制避免 OOM
RUN NODE_OPTIONS="--max-old-space-size=4096" npm run build
# ============================================
# 生产阶段 - 轻量级nginx镜像