Compare commits
4 Commits
test
...
3bc9304fa9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bc9304fa9 | ||
|
|
a2ba73e33d | ||
|
|
bb669ef422 | ||
|
|
44beaa164d |
@@ -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
|
||||
|
||||
@@ -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镜像
|
||||
|
||||
Reference in New Issue
Block a user