From 910a7cb87763ecf6a25765862eeaf95425bfa583 Mon Sep 17 00:00:00 2001 From: Maurizio Vitale Date: Thu, 13 Jan 2022 11:37:50 +0000 Subject: [PATCH] AAE-6809 Expose property for custom dockerfile name (#7445) --- lib/cli/scripts/docker.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/cli/scripts/docker.ts b/lib/cli/scripts/docker.ts index d139f69145..dceff75a5a 100644 --- a/lib/cli/scripts/docker.ts +++ b/lib/cli/scripts/docker.ts @@ -27,6 +27,7 @@ enum TARGETS { Link = 'link' } +const DOCKER_FILENAME = 'Dockerfile'; export interface PublishArgs { tag?: string; loginCheck?: boolean; @@ -37,6 +38,7 @@ export interface PublishArgs { buildArgs?: string[]; dockerTags?: string; pathProject: string; + fileName: string; } function loginPerform(args: PublishArgs) { @@ -58,7 +60,7 @@ function buildImagePerform(args: PublishArgs, tag: string) { }); } - const response = exec('docker', ['build', `-t=${args.dockerRepo}:${tag}`, ...buildArgs, args.pathProject], {}); + const response = exec('docker', ['build', `-t=${args.dockerRepo}:${tag}`, ...buildArgs, `-f=${args.fileName}`, args.pathProject], {}); logger.info(response); } @@ -102,6 +104,7 @@ function main(args) { .option('--pathProject [type]', 'the path build context') .option('--sourceTag [type]', 'sourceTag') .option('--buildArgs [type...]', 'buildArgs') + .option('--fileName [type...]', 'Docker file name', DOCKER_FILENAME) .option('--target [type]', 'target: publish or link', TARGETS.Publish) .requiredOption('--dockerRepo [type]', 'docker repo') .requiredOption('--dockerTags [type]', ' tags') @@ -131,6 +134,10 @@ function main(args) { args.pathProject = resolve('./'); } + if (args.fileName === undefined) { + args.fileName = DOCKER_FILENAME; + } + if (args.loginCheck === true) { loginPerform(args); }