mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[AAE-6118] make builder args a variadic options (#7296)
* make builder args a variadic options * Update docker.ts
This commit is contained in:
parent
1e62b46060
commit
567ca18547
@ -26,6 +26,7 @@ enum TARGETS {
|
||||
Publish = 'publish',
|
||||
Link = 'link'
|
||||
}
|
||||
|
||||
export interface PublishArgs {
|
||||
tag?: string;
|
||||
loginCheck?: boolean;
|
||||
@ -33,7 +34,7 @@ export interface PublishArgs {
|
||||
loginPassword?: string;
|
||||
loginRepo?: string;
|
||||
dockerRepo?: string;
|
||||
buildArgs?: string;
|
||||
buildArgs?: string[];
|
||||
dockerTags?: string;
|
||||
pathProject: string;
|
||||
}
|
||||
@ -46,7 +47,14 @@ function loginPerform(args: PublishArgs) {
|
||||
|
||||
function buildImagePerform(args: PublishArgs, tag: string) {
|
||||
logger.info(`Perform docker build...${args.dockerRepo}:${tag}`);
|
||||
const response = exec('docker', ['build', `-t=${args.dockerRepo}:${tag}`, `--build-arg=${args.buildArgs}`, args.pathProject], {});
|
||||
|
||||
let buildArgs = [];
|
||||
|
||||
args.buildArgs.forEach((envVar) => {
|
||||
buildArgs.push (`--build-arg=${envVar}`);
|
||||
});
|
||||
|
||||
const response = exec('docker', ['build', `-t=${args.dockerRepo}:${tag}`, ...buildArgs, args.pathProject], {});
|
||||
logger.info(response);
|
||||
}
|
||||
|
||||
@ -89,7 +97,7 @@ function main(args) {
|
||||
.option('--loginCheck [type]', 'perform login')
|
||||
.option('--pathProject [type]', 'the path build context')
|
||||
.option('--sourceTag [type]', 'sourceTag')
|
||||
.option('--buildArgs [type]', 'buildArgs')
|
||||
.option('--buildArgs [type...]', 'buildArgs')
|
||||
.option('--target [type]', 'target: publish or link', TARGETS.Publish)
|
||||
.requiredOption('--dockerRepo [type]', 'docker repo')
|
||||
.requiredOption('--dockerTags [type]', ' tags')
|
||||
@ -125,7 +133,7 @@ function main(args) {
|
||||
|
||||
let mainTag;
|
||||
if (args.dockerTags !== '') {
|
||||
args.dockerTags.split(',').forEach( (tag, index) => {
|
||||
args.dockerTags.split(',').forEach((tag, index) => {
|
||||
if (tag) {
|
||||
logger.info(`Analyzing tag:${tag} ... for target ${program.opts().target}`);
|
||||
if (program.opts().target === TARGETS.Publish) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user