mirror of
https://github.com/docker/build-push-action.git
synced 2026-07-18 11:59:58 +08:00
feat: add eStargz compression support for faster image pulls (#1)
- Add estargz boolean input parameter to action.yml - Modify buildx output arguments to include estargz compression flags when enabled - Add buildx version check (requires >= 0.10.0) and push requirement validation - Update README.md with usage examples and documentation - Requires push: true to be effective - Compatible with existing output configurations Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Raunak Chowdhuri <raunak@reducto.ai>
This commit is contained in:
parent
4af38cd115
commit
527d67c3c7
3 changed files with 62 additions and 2 deletions
|
|
@ -57,6 +57,7 @@ export interface Inputs {
|
|||
target: string;
|
||||
ulimit: string[];
|
||||
'github-token': string;
|
||||
estargz: boolean;
|
||||
}
|
||||
|
||||
export async function getInputs(): Promise<Inputs> {
|
||||
|
|
@ -93,7 +94,8 @@ export async function getInputs(): Promise<Inputs> {
|
|||
tags: Util.getInputList('tags'),
|
||||
target: core.getInput('target'),
|
||||
ulimit: Util.getInputList('ulimit', {ignoreComma: true}),
|
||||
'github-token': core.getInput('github-token')
|
||||
'github-token': core.getInput('github-token'),
|
||||
estargz: core.getBooleanInput('estargz')
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -208,11 +210,33 @@ async function getBuildArgs(inputs: Inputs, context: string, toolkit: Toolkit):
|
|||
args.push('--no-cache-filter', noCacheFilter);
|
||||
});
|
||||
await Util.asyncForEach(inputs.outputs, async output => {
|
||||
args.push('--output', output);
|
||||
if (inputs.estargz && inputs.push) {
|
||||
if (output.startsWith('type=registry') || output === 'type=registry') {
|
||||
const estargzOutput = output.includes(',')
|
||||
? `${output},compression=estargz,force-compression=true,oci-mediatypes=true`
|
||||
: `${output},compression=estargz,force-compression=true,oci-mediatypes=true`;
|
||||
args.push('--output', estargzOutput);
|
||||
} else {
|
||||
args.push('--output', output);
|
||||
}
|
||||
} else {
|
||||
args.push('--output', output);
|
||||
}
|
||||
});
|
||||
|
||||
if (inputs.estargz && inputs.push && inputs.outputs.length === 0) {
|
||||
args.push('--output', 'type=registry,compression=estargz,force-compression=true,oci-mediatypes=true');
|
||||
}
|
||||
if (inputs.platforms.length > 0) {
|
||||
args.push('--platform', inputs.platforms.join(','));
|
||||
}
|
||||
if (inputs.estargz) {
|
||||
if (!(await toolkit.buildx.versionSatisfies('>=0.10.0'))) {
|
||||
core.warning("eStargz compression requires buildx >= 0.10.0; the input 'estargz' is ignored.");
|
||||
} else if (!inputs.push) {
|
||||
core.warning("eStargz compression requires push: true; the input 'estargz' is ignored.");
|
||||
}
|
||||
}
|
||||
if (await toolkit.buildx.versionSatisfies('>=0.10.0')) {
|
||||
args.push(...(await getAttestArgs(inputs, toolkit)));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue