mirror of
https://github.com/redhat-actions/buildah-build.git
synced 2025-06-08 01:49:03 +00:00
* add support for building images with docker files (#4) Signed-off-by: Luca Stocchi <lstocchi@redhat.com> * fix issues when building image with dockerfile Signed-off-by: Luca Stocchi <lstocchi@redhat.com> * update readme Signed-off-by: Luca Stocchi <lstocchi@redhat.com> * Update README.md Co-authored-by: Divyanshu Agrawal <diagrawa@redhat.com> Co-authored-by: Divyanshu Agrawal <diagrawa@redhat.com>
This commit is contained in:
parent
329be0a470
commit
deaddbe502
7 changed files with 137 additions and 43 deletions
|
@ -3,6 +3,7 @@ import * as exec from "@actions/exec";
|
|||
import { CommandResult } from "./types";
|
||||
|
||||
interface Buildah {
|
||||
buildUsingDocker(image: string, context: string, dockerFiles: string[]): Promise<CommandResult>;
|
||||
from(baseImage: string): Promise<CommandResult>;
|
||||
copy(container: string, contentToCopy: string[]): Promise<CommandResult>;
|
||||
config(container: string, setting: {}): Promise<CommandResult>;
|
||||
|
@ -24,6 +25,18 @@ export class BuildahCli implements Buildah {
|
|||
this.executable = executable;
|
||||
}
|
||||
|
||||
async buildUsingDocker(image: string, context: string, dockerFiles: string[]): Promise<CommandResult> {
|
||||
const args: string[] = ['bud'];
|
||||
dockerFiles.forEach(file => {
|
||||
args.push('-f');
|
||||
args.push(file);
|
||||
});
|
||||
args.push('-t');
|
||||
args.push(image);
|
||||
args.push(context);
|
||||
return await this.execute(args);
|
||||
}
|
||||
|
||||
async from(baseImage: string): Promise<CommandResult> {
|
||||
return await this.execute(['from', baseImage]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue