diff --git a/pkg/build/image/dockerfile.go b/pkg/build/image/dockerfile.go index 0c4695fedb..dad63e8176 100644 --- a/pkg/build/image/dockerfile.go +++ b/pkg/build/image/dockerfile.go @@ -83,7 +83,7 @@ func mapDockerfileToImagesSets(ctx context.Context, cfg *dockerfile.Dockerfile, return nil, fmt.Errorf("unable to create image %q: %w", "test", err) } - img.stages = append(img.stages, stage_instruction.NewRun(backend_instruction.NewRun(*dockerfile_instruction.NewRun([]string{"ls", "/"})), nil, false, &stage.BaseStageOptions{ + img.stages = append(img.stages, stage_instruction.NewRun(backend_instruction.NewRun(*dockerfile_instruction.NewRun([]string{"ls", "/"}, nil, nil, false)), nil, false, &stage.BaseStageOptions{ ImageName: img.Name, ImageTmpDir: img.TmpDir, ContainerWerfDir: img.ContainerWerfDir, diff --git a/pkg/dockerfile/instruction/add.go b/pkg/dockerfile/instruction/add.go index 68a6dc3b84..62d8e0362a 100644 --- a/pkg/dockerfile/instruction/add.go +++ b/pkg/dockerfile/instruction/add.go @@ -1,12 +1,14 @@ package instruction type Add struct { - Src []string - Dst string + Src []string + Dst string + Chown string + Chmod string } -func NewAdd(src []string, dst string) *Add { - return &Add{Src: src, Dst: dst} +func NewAdd(src []string, dst, chown, chmod string) *Add { + return &Add{Src: src, Dst: dst, Chown: chown, Chmod: chmod} } func (i *Add) Name() string { diff --git a/pkg/dockerfile/instruction/arg.go b/pkg/dockerfile/instruction/arg.go new file mode 100644 index 0000000000..58b052f951 --- /dev/null +++ b/pkg/dockerfile/instruction/arg.go @@ -0,0 +1,15 @@ +package instruction + +import "github.com/moby/buildkit/frontend/dockerfile/instructions" + +type Arg struct { + Args []instructions.KeyValuePairOptional +} + +func NewArg(args []instructions.KeyValuePairOptional) *Arg { + return &Arg{Args: args} +} + +func (i *Arg) Name() string { + return "ARG" +} diff --git a/pkg/dockerfile/instruction/cmd.go b/pkg/dockerfile/instruction/cmd.go index e78818c354..1cc4d21b50 100644 --- a/pkg/dockerfile/instruction/cmd.go +++ b/pkg/dockerfile/instruction/cmd.go @@ -1,11 +1,12 @@ package instruction type Cmd struct { - Cmd []string + Cmd []string + PrependShell bool } -func NewCmd(cmd []string) *Cmd { - return &Cmd{Cmd: cmd} +func NewCmd(cmd []string, prependShell bool) *Cmd { + return &Cmd{Cmd: cmd, PrependShell: prependShell} } func (i *Cmd) Name() string { diff --git a/pkg/dockerfile/instruction/copy.go b/pkg/dockerfile/instruction/copy.go index fd7863f77d..5a3ac4837c 100644 --- a/pkg/dockerfile/instruction/copy.go +++ b/pkg/dockerfile/instruction/copy.go @@ -1,13 +1,15 @@ package instruction type Copy struct { - From string - Src []string - Dst string + From string + Src []string + Dst string + Chown string + Chmod string } -func NewCopy(from string, src []string, dst string) *Copy { - return &Copy{From: from, Src: src, Dst: dst} +func NewCopy(from string, src []string, dst, chown, chmod string) *Copy { + return &Copy{From: from, Src: src, Dst: dst, Chown: chown, Chmod: chmod} } func (i *Copy) Name() string { diff --git a/pkg/dockerfile/instruction/entrypoint.go b/pkg/dockerfile/instruction/entrypoint.go index 9744e056b9..f19f775cd9 100644 --- a/pkg/dockerfile/instruction/entrypoint.go +++ b/pkg/dockerfile/instruction/entrypoint.go @@ -1,11 +1,12 @@ package instruction type Entrypoint struct { - Entrypoint []string + Entrypoint []string + PrependShell bool } -func NewEntrypoint(entrypoint []string) *Entrypoint { - return &Entrypoint{Entrypoint: entrypoint} +func NewEntrypoint(entrypoint []string, prependShell bool) *Entrypoint { + return &Entrypoint{Entrypoint: entrypoint, PrependShell: prependShell} } func (i *Entrypoint) Name() string { diff --git a/pkg/dockerfile/instruction/healthcheck.go b/pkg/dockerfile/instruction/healthcheck.go index d49794ed1c..b04547d82d 100644 --- a/pkg/dockerfile/instruction/healthcheck.go +++ b/pkg/dockerfile/instruction/healthcheck.go @@ -1,8 +1,10 @@ package instruction +import "github.com/docker/docker/api/types/container" + type Healthcheck struct { - Type HealthcheckType - Command string + Type HealthcheckType + Config *container.HealthConfig } type HealthcheckType string @@ -12,3 +14,11 @@ var ( HealthcheckTypeCmd HealthcheckType = "CMD" HealthcheckTypeCmdShell HealthcheckType = "CMD-SHELL" ) + +func NewHealthcheck(t HealthcheckType, cfg *container.HealthConfig) *Healthcheck { + return &Healthcheck{Type: t, Config: cfg} +} + +func (i *Healthcheck) Name() string { + return "HEALTHCHECK" +} diff --git a/pkg/dockerfile/instruction/maintainer.go b/pkg/dockerfile/instruction/maintainer.go new file mode 100644 index 0000000000..d6a99eedfd --- /dev/null +++ b/pkg/dockerfile/instruction/maintainer.go @@ -0,0 +1,9 @@ +package instruction + +type Maintainer struct { + Maintainer string +} + +func (i *Maintainer) Name() string { + return "MAINTAINER" +} diff --git a/pkg/dockerfile/instruction/run.go b/pkg/dockerfile/instruction/run.go index 04b1ae09c8..fba0419147 100644 --- a/pkg/dockerfile/instruction/run.go +++ b/pkg/dockerfile/instruction/run.go @@ -1,11 +1,16 @@ package instruction +import "github.com/opencontainers/runtime-spec/specs-go" + type Run struct { - Command []string + Command []string + Args []string // runtime args like --security and --network + Mounts []specs.Mount // structured --mount args + PrependShell bool } -func NewRun(command []string) *Run { - return &Run{Command: command} +func NewRun(command, args []string, mounts []specs.Mount, prependShell bool) *Run { + return &Run{Command: command, Args: args, Mounts: mounts, PrependShell: prependShell} } func (i *Run) Name() string {