mirror of
https://github.com/142vip/408CSFamily.git
synced 2026-02-03 02:23:38 +08:00
fix(CI): 修复流水线构建镜像异常 (#68)
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
* - ./scripts/bundle 交互式选择执行的命令
|
||||
*/
|
||||
|
||||
const { execShell } = require('./.exec')
|
||||
const { Select } = require('enquirer')
|
||||
const {execShell} = require('./.exec')
|
||||
const {Select} = require('enquirer')
|
||||
|
||||
const packageVersion = require('../package.json').version
|
||||
const projectName = '408CSFamily'
|
||||
@@ -28,7 +28,7 @@ const imageName = `${repoAddress}:${projectName}-${packageVersion}`
|
||||
* @param needProxy
|
||||
* @returns {string[]}
|
||||
*/
|
||||
function getBuildImageScript({ containerBuild, preBuild, needProxy = false }) {
|
||||
function getBuildImageScript({containerBuild, preBuild, needProxy = false}) {
|
||||
// 基础构建脚本
|
||||
let baseBuildScript = ''
|
||||
|
||||
@@ -37,17 +37,17 @@ function getBuildImageScript({ containerBuild, preBuild, needProxy = false }) {
|
||||
}
|
||||
|
||||
return [
|
||||
// 构建镜像
|
||||
`
|
||||
// 构建镜像
|
||||
`
|
||||
${baseBuildScript}
|
||||
docker build \
|
||||
--build-arg APP_VERSION=${packageVersion} \
|
||||
--build-arg CONTAINER_BUILD=${containerBuild} \
|
||||
-t ${imageName} .
|
||||
`,
|
||||
// 推送镜像
|
||||
`
|
||||
if [[ "$(docker images -q ${imageName} 2> /dev/null)" != "" ]];then
|
||||
// 推送镜像
|
||||
`
|
||||
if [ "$(docker images -q ${imageName} 2> /dev/null)" != "" ];then
|
||||
## 推送
|
||||
docker push ${imageName}
|
||||
echo "---------------- 上传镜像成功,删除本地镜像 ---------------- "
|
||||
@@ -125,13 +125,15 @@ async function getScriptCommand() {
|
||||
scriptCommand = await prompt.run()
|
||||
} else {
|
||||
// 命中支持的脚本
|
||||
if (Object.keys(SupportScripts).includes(scriptName)) { scriptCommand = SupportScripts[scriptName] }
|
||||
if (Object.keys(SupportScripts).includes(scriptName)) {
|
||||
scriptCommand = SupportScripts[scriptName]
|
||||
}
|
||||
}
|
||||
return scriptCommand
|
||||
}
|
||||
|
||||
|
||||
;(async() => {
|
||||
;(async () => {
|
||||
const scriptCommand = await getScriptCommand()
|
||||
await execShell(scriptCommand)
|
||||
})()
|
||||
|
||||
Reference in New Issue
Block a user