mirror of
https://github.com/redhat-actions/buildah-build.git
synced 2025-06-08 01:49:03 +00:00
Add Layers input for build using dockerfile (#43)
Also add link to buildah docs in the README Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
parent
54ff9945b9
commit
3196e5acb5
8 changed files with 28 additions and 11 deletions
|
@ -13,7 +13,8 @@ export interface BuildahConfigSettings {
|
|||
|
||||
interface Buildah {
|
||||
buildUsingDocker(
|
||||
image: string, context: string, dockerFiles: string[], buildArgs: string[], useOCI: boolean, archs: string,
|
||||
image: string, context: string, dockerFiles: string[], buildArgs: string[],
|
||||
useOCI: boolean, archs: string, layers: string
|
||||
): Promise<CommandResult>;
|
||||
from(baseImage: string): Promise<CommandResult>;
|
||||
copy(container: string, contentToCopy: string[]): Promise<CommandResult | undefined>;
|
||||
|
@ -33,7 +34,8 @@ export class BuildahCli implements Buildah {
|
|||
}
|
||||
|
||||
async buildUsingDocker(
|
||||
image: string, context: string, dockerFiles: string[], buildArgs: string[], useOCI: boolean, archs: string
|
||||
image: string, context: string, dockerFiles: string[], buildArgs: string[],
|
||||
useOCI: boolean, archs: string, layers: string
|
||||
): Promise<CommandResult> {
|
||||
const args: string[] = [ "bud" ];
|
||||
if (archs) {
|
||||
|
@ -49,6 +51,9 @@ export class BuildahCli implements Buildah {
|
|||
args.push(buildArg);
|
||||
});
|
||||
args.push(...BuildahCli.getImageFormatOption(useOCI));
|
||||
if (layers) {
|
||||
args.push(`--layers=${layers}`);
|
||||
}
|
||||
args.push("-t");
|
||||
args.push(image);
|
||||
args.push(context);
|
||||
|
|
|
@ -55,6 +55,12 @@ export enum Inputs {
|
|||
* Default: None.
|
||||
*/
|
||||
IMAGE = "image",
|
||||
/**
|
||||
* Set to true to cache intermediate layers during build process
|
||||
* Required: false
|
||||
* Default: None.
|
||||
*/
|
||||
LAYERS = "layers",
|
||||
/**
|
||||
* Set to true to build using the OCI image format instead of the Docker image format
|
||||
* Required: false
|
||||
|
|
|
@ -61,7 +61,8 @@ async function doBuildUsingDockerFiles(
|
|||
const context = path.join(workspace, core.getInput(Inputs.CONTEXT));
|
||||
const buildArgs = getInputList(Inputs.BUILD_ARGS);
|
||||
const dockerFileAbsPaths = dockerFiles.map((file) => path.join(workspace, file));
|
||||
await cli.buildUsingDocker(newImage, context, dockerFileAbsPaths, buildArgs, useOCI, archs);
|
||||
const layers = core.getInput(Inputs.LAYERS);
|
||||
await cli.buildUsingDocker(newImage, context, dockerFileAbsPaths, buildArgs, useOCI, archs, layers);
|
||||
}
|
||||
|
||||
async function doBuildFromScratch(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue