support build_args
This commit is contained in:
parent
89b8bb6cb3
commit
e474cef09b
@ -96,6 +96,11 @@ inputs:
|
||||
default: ""
|
||||
required: false
|
||||
|
||||
build_args:
|
||||
description: "list of docker build args to pass to docker (--build-arg key1=value1) as newline seperated multiline string, eg key1=value1\nkey2=value2"
|
||||
default: ""
|
||||
required: false
|
||||
|
||||
outputs:
|
||||
published_tags:
|
||||
description: "Published tags as csv"
|
||||
|
||||
20
dist/index.js
vendored
20
dist/index.js
vendored
@ -62276,6 +62276,26 @@ function prepareDockerArgs(destinations) {
|
||||
dockerArgs.push(core.getInput('additional_registry_destinations'));
|
||||
}
|
||||
|
||||
if (isNonEmptyStr(core.getInput('build_args'))) {
|
||||
let buildArgs = core.getInput('build_args')
|
||||
.split('\n')
|
||||
.map(s => s.trim())
|
||||
.map(s => {
|
||||
const equalIndex = s.indexOf('=');
|
||||
const key = s.substring(0, equalIndex - 1);
|
||||
const value = s.substring(equalIndex + 1);
|
||||
return {
|
||||
key,
|
||||
value
|
||||
};
|
||||
});
|
||||
|
||||
console.logs('parsed build_args as: ', JSON.stringify(buildArgs, null, 2));
|
||||
buildArgs.forEach(arg => {
|
||||
dockerArgs.push(`--build-arg ${arg.key}="${arv.value}"`);
|
||||
});
|
||||
}
|
||||
|
||||
return dockerArgs;
|
||||
}
|
||||
|
||||
|
||||
20
src/lib.js
20
src/lib.js
@ -174,6 +174,26 @@ export function prepareDockerArgs(destinations) {
|
||||
dockerArgs.push(core.getInput('additional_registry_destinations'));
|
||||
}
|
||||
|
||||
if (isNonEmptyStr(core.getInput('build_args'))) {
|
||||
let buildArgs = core.getInput('build_args')
|
||||
.split('\n')
|
||||
.map(s => s.trim())
|
||||
.map(s => {
|
||||
const equalIndex = s.indexOf('=');
|
||||
const key = s.substring(0, equalIndex - 1);
|
||||
const value = s.substring(equalIndex + 1);
|
||||
return {
|
||||
key,
|
||||
value
|
||||
};
|
||||
});
|
||||
|
||||
console.logs('parsed build_args as: ', JSON.stringify(buildArgs, null, 2));
|
||||
buildArgs.forEach(arg => {
|
||||
dockerArgs.push(`--build-arg ${arg.key}="${arv.value}"`);
|
||||
});
|
||||
}
|
||||
|
||||
return dockerArgs;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user