-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbundle
More file actions
executable file
·53 lines (47 loc) · 1.19 KB
/
bundle
File metadata and controls
executable file
·53 lines (47 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env node
/**
* 功能:构建Docker镜像
* 使用:
* - ./scripts/bundle
* - ./scripts/bundle --proxy
*/
import {
OPEN_SOURCE_ADDRESS,
OPEN_SOURCE_AUTHOR,
VipDocker,
VipGit,
VipNodeJS,
VipPackageJSON,
} from '@142vip/utils'
(async () => {
try {
// 获取package.json文件
const { name, version, description } = VipPackageJSON.getPackageJSON()
// 镜像地址
const imageName = `${OPEN_SOURCE_ADDRESS.DOCKER_ALIYUNCS_VIP}/docs:${name}-${version}`
// 最近一次提交信息
const gitHash = VipGit.getFirstCommitHash()
// 构建镜像
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', gitHash],
],
memory: 20000,
push: true,
delete: true,
logger: true,
})
}
catch (e) {
console.log('异常信息:', e)
}
})()