File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ interface BuildImageDockerOptions extends DockerOptions {
2222 // build命令时,GC限制内存大小
2323 memory ?: number
2424 platform ?: string
25+ progress ?: 'plain' | 'auto' | boolean
2526}
2627
2728interface UserLoginDockerOptions extends DockerOptions {
@@ -235,8 +236,11 @@ async function buildImage(args: BuildImageDockerOptions): Promise<void> {
235236 const targetParams = args . target != null ? `--target ${ args . target } ` : ''
236237 const memoryParams = args . memory != null ? `--memory=${ args . memory } mb` : ''
237238 const platformParams = args . platform != null ? `--platform=${ args . platform } ` : ''
239+ const pushParams = args . push ? '--push' : ''
240+ const progressParmas = args . progress ? `--progress=${ args . progress } ` : ''
238241
239- const command = `docker build ${ buildArg } ${ targetParams } ${ memoryParams } ${ platformParams } -t '${ args . imageName } ' .`
242+ // 支持buildx
243+ const command = `DOCKER_BUILDKIT=1 docker buildx build ${ buildArg } ${ pushParams } ${ progressParmas } ${ targetParams } ${ memoryParams } ${ platformParams } -t '${ args . imageName } ' .`
240244
241245 if ( args . logger ) {
242246 vipLogger . log ( `执行的命令:\n` , { startLabel : VipSymbols . success } )
@@ -246,15 +250,6 @@ async function buildImage(args: BuildImageDockerOptions): Promise<void> {
246250
247251 await scriptExecutor ( command )
248252
249- if ( args . push ) {
250- const exist = await isExistImage ( args . imageName )
251-
252- if ( exist ) {
253- vipLogger . log ( args . imageName , { startLabel : '推送镜像' } )
254- await pushImage ( args . imageName )
255- }
256- }
257-
258253 // 推送完删除
259254 if ( args . push && args . delete ) {
260255 vipLogger . log ( args . imageName , { startLabel : '删除镜像' } )
You can’t perform that action at this time.
0 commit comments