1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-07-04 05:56:16 +08:00

fix: 升级ci脚本依赖,修复构建、部署异常

This commit is contained in:
chufan
2026-06-24 17:54:57 +08:00
parent ec4f19d069
commit 5c8c34cd3f
4 changed files with 1163 additions and 1130 deletions

View File

@@ -1,49 +1,45 @@
import { OPEN_SOURCE_ADDRESS, OPEN_SOURCE_AUTHOR } from '@142vip/open-source'
import {
VipConsole,
VipDocker,
VipGit,
VipNodeJS,
VipPackageJSON,
} from '@142vip/utils'
import { VipDocker, VipGit, VipNodeJS, VipPackageJSON } from '@142vip/utils'
/**
* 功能构建Docker镜像
*/
async function buildImageMain(): Promise<void> {
try {
// 获取package.json文件
const { name, version, description } = VipPackageJSON.getPackageJSON<{ description: string }>()
// 获取package.json文件
const { name, version, description } = VipPackageJSON.getPackageJSON<{ description: string }>()
// 镜像地址
const imageName = `${OPEN_SOURCE_ADDRESS.DOCKER_ALIYUNCS_VIP}/docs:${name}-${version}`
// 镜像地址
const imageName = `${OPEN_SOURCE_ADDRESS.DOCKER_ALIYUNCS_VIP}/docs:${name}-${version}`
// 最近一次提交信息
const shortGitHash = VipGit.getRecentCommitShortHash()
// 最近一次提交信息
const gitShortHash = VipGit.getRecentCommitShortHash()
// 构建镜像
await VipDocker.buildImage({
imageName,
buildArgs: [
// 参数中是否包含 --proxy
['NEED_PROXY', VipNodeJS.getProcessArgv().includes('--proxy')],
['APP_NAME', name],
['APP_VERSION', version],
['APP_DESCRIPTION', description],
['AUTHOR', OPEN_SOURCE_AUTHOR.name],
['EMAIL', OPEN_SOURCE_AUTHOR.email],
['HOME_PAGE', OPEN_SOURCE_AUTHOR.homePage],
['GIT_HASH', shortGitHash],
],
memory: 20000,
push: true,
delete: true,
logger: true,
})
}
catch (e) {
VipConsole.trace('异常信息:', e)
let realImageName = imageName
// 如果version是否为预发布是预发布则用hash当镜像名
if (VipGit.isPrerelease(version)) {
realImageName = `${imageName.split(':')[0]}:${name}-${version}-${gitShortHash}`
}
// 构建镜像
await VipDocker.buildImage({
imageName: realImageName,
buildArgs: [
// 参数中是否包含 --proxy
['NEED_PROXY', VipNodeJS.getProcessArgv().includes('--proxy')],
['APP_NAME', name],
['APP_VERSION', version],
['APP_DESCRIPTION', description],
['AUTHOR', OPEN_SOURCE_AUTHOR.name],
['EMAIL', OPEN_SOURCE_AUTHOR.email],
['HOME_PAGE', OPEN_SOURCE_AUTHOR.homePage],
['GIT_HASH', gitShortHash],
],
memory: 200000,
push: true,
delete: true,
logger: true,
progress: 'plain',
})
}
void buildImageMain()