AAE-6809 Expose property for custom dockerfile name (#7445)

This commit is contained in:
Maurizio Vitale
2022-01-13 11:37:50 +00:00
committed by GitHub
parent 214cb321e9
commit 910a7cb877

View File

@@ -27,6 +27,7 @@ enum TARGETS {
Link = 'link' Link = 'link'
} }
const DOCKER_FILENAME = 'Dockerfile';
export interface PublishArgs { export interface PublishArgs {
tag?: string; tag?: string;
loginCheck?: boolean; loginCheck?: boolean;
@@ -37,6 +38,7 @@ export interface PublishArgs {
buildArgs?: string[]; buildArgs?: string[];
dockerTags?: string; dockerTags?: string;
pathProject: string; pathProject: string;
fileName: string;
} }
function loginPerform(args: PublishArgs) { 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); logger.info(response);
} }
@@ -102,6 +104,7 @@ function main(args) {
.option('--pathProject [type]', 'the path build context') .option('--pathProject [type]', 'the path build context')
.option('--sourceTag [type]', 'sourceTag') .option('--sourceTag [type]', 'sourceTag')
.option('--buildArgs [type...]', 'buildArgs') .option('--buildArgs [type...]', 'buildArgs')
.option('--fileName [type...]', 'Docker file name', DOCKER_FILENAME)
.option('--target [type]', 'target: publish or link', TARGETS.Publish) .option('--target [type]', 'target: publish or link', TARGETS.Publish)
.requiredOption('--dockerRepo [type]', 'docker repo') .requiredOption('--dockerRepo [type]', 'docker repo')
.requiredOption('--dockerTags [type]', ' tags') .requiredOption('--dockerTags [type]', ' tags')
@@ -131,6 +134,10 @@ function main(args) {
args.pathProject = resolve('./'); args.pathProject = resolve('./');
} }
if (args.fileName === undefined) {
args.fileName = DOCKER_FILENAME;
}
if (args.loginCheck === true) { if (args.loginCheck === true) {
loginPerform(args); loginPerform(args);
} }