commands

package
v1.25.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package commands provides fake implementations for testing in the commands package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseArg

func ParseArg(key string, val *string, env []string,
	ba *dockerfile.BuildArgs) (resolvedKey string, resolvedValue *string, err error)

ParseArg parses and resolves ARG key/value pairs with environment variable substitution

Types

type AbstractCopyCommand

type AbstractCopyCommand interface {
	From() string
}

AbstractCopyCommand can either be a CopyCommand or a CachingCopyCommand.

func CastAbstractCopyCommand

func CastAbstractCopyCommand[T CommandType](cmd T) (AbstractCopyCommand, bool)

CastAbstractCopyCommand tries to convert a command to an AbstractCopyCommand. It accepts any type that implements the CommandType constraint. This generic function provides type-safe casting of copy commands.

type AddCommand

type AddCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

AddCommand represents the ADD Dockerfile instruction which copies files, directories, or remote URLs from the build context or remote locations into the container image

func (*AddCommand) ExecuteCommand

func (a *AddCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand executes the ADD command Special stuff about ADD:

  1. If <src> is a remote file URL: - destination will have permissions of 0600 - If remote file has HTTP Last-Modified header, we set the mtime of the file to that timestamp - If dest doesn't end with a slash, the filepath is inferred to be <dest>/<filename>
  2. If <src> is a local tar archive: - it is unpacked at the dest, as 'tar -x' would

func (*AddCommand) FilesToSnapshot

func (a *AddCommand) FilesToSnapshot() []string

FilesToSnapshot should return an empty array if still nil; no files were changed

func (*AddCommand) FilesUsedFromContext

func (a *AddCommand) FilesUsedFromContext(config *v1.Config, buildArgs *dockerfile.BuildArgs) ([]string, error)

FilesUsedFromContext returns the list of files from the build context that are used by this ADD command, excluding remote URLs and local tar archives

func (*AddCommand) MetadataOnly

func (a *AddCommand) MetadataOnly() bool

MetadataOnly indicates whether this command only affects metadata without modifying the filesystem contents

func (*AddCommand) RequiresUnpackedFS

func (a *AddCommand) RequiresUnpackedFS() bool

RequiresUnpackedFS indicates whether this command requires an unpacked filesystem to execute properly

func (*AddCommand) String

func (a *AddCommand) String() string

String returns some information about the command for the image config

type ArgCommand

type ArgCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

ArgCommand implements the Dockerfile ARG instruction

func (*ArgCommand) ExecuteCommand

func (r *ArgCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand only needs to add this ARG key/value as seen

func (*ArgCommand) String

func (r *ArgCommand) String() string

String returns some information about the command for the image config history

type BaseCommand

type BaseCommand struct {
}

BaseCommand provides the base implementation for all Docker command types with default implementations for common methods used by specific commands

func (*BaseCommand) CacheCommand

func (b *BaseCommand) CacheCommand(v1.Image) DockerCommand

CacheCommand creates a caching version of the command for efficient layer caching and reuse in subsequent builds (default: nil)

func (*BaseCommand) FilesToSnapshot

func (b *BaseCommand) FilesToSnapshot() []string

FilesToSnapshot returns the list of files that were modified during command execution and should be included in the filesystem snapshot (default: empty)

func (*BaseCommand) FilesUsedFromContext

func (b *BaseCommand) FilesUsedFromContext(_ *v1.Config, _ *dockerfile.BuildArgs) ([]string, error)

FilesUsedFromContext returns the list of files from the build context that are used by this command (default: empty)

func (*BaseCommand) IsArgsEnvsRequiredInCache

func (b *BaseCommand) IsArgsEnvsRequiredInCache() bool

IsArgsEnvsRequiredInCache indicates whether command arguments and environment variables should be considered for cache key generation (default: false)

func (*BaseCommand) MetadataOnly

func (b *BaseCommand) MetadataOnly() bool

MetadataOnly indicates whether this command only affects metadata without modifying the filesystem contents (default: true)

func (*BaseCommand) ProvidesFilesToSnapshot

func (b *BaseCommand) ProvidesFilesToSnapshot() bool

ProvidesFilesToSnapshot indicates whether this command provides files for snapshotting (default: true)

func (*BaseCommand) RequiresUnpackedFS

func (b *BaseCommand) RequiresUnpackedFS() bool

RequiresUnpackedFS indicates whether this command requires an unpacked filesystem to execute properly (default: false)

func (*BaseCommand) ShouldCacheOutput

func (b *BaseCommand) ShouldCacheOutput() bool

ShouldCacheOutput indicates whether the output of this command should be cached (default: false)

func (*BaseCommand) ShouldDetectDeletedFiles

func (b *BaseCommand) ShouldDetectDeletedFiles() bool

ShouldDetectDeletedFiles indicates whether this command should detect and track files that were deleted during execution (default: false)

type BaseCommandExecutor

type BaseCommandExecutor struct {
	// contains filtered or unexported fields
}

BaseCommandExecutor provides common execution patterns for commands

func NewBaseCommandExecutor

func NewBaseCommandExecutor() *BaseCommandExecutor

NewBaseCommandExecutor creates a new base command executor

func (*BaseCommandExecutor) ExecuteWithErrorHandling

func (e *BaseCommandExecutor) ExecuteWithErrorHandling(operation string, fn func() error) error

ExecuteWithErrorHandling executes a function with common error handling

func (*BaseCommandExecutor) GetHelper

func (e *BaseCommandExecutor) GetHelper() *CommonCommandHelper

GetHelper returns the common command helper

func (*BaseCommandExecutor) LogExecution

func (e *BaseCommandExecutor) LogExecution(cmdName string, details ...string)

LogExecution logs command execution with common format

type Cached

type Cached interface {
	Layer() v1.Layer
}

Cached represents an interface for cached container image layers

type CachingCopyCommand

type CachingCopyCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

CachingCopyCommand implements caching for COPY commands.

func (*CachingCopyCommand) ExecuteCommand

func (cr *CachingCopyCommand) ExecuteCommand(_ *v1.Config, _ *dockerfile.BuildArgs) error

ExecuteCommand executes the cached COPY command by extracting files from cached layers.

func (*CachingCopyCommand) FilesToSnapshot

func (cr *CachingCopyCommand) FilesToSnapshot() []string

FilesToSnapshot returns the list of files extracted from cached layers.

func (*CachingCopyCommand) FilesUsedFromContext

func (cr *CachingCopyCommand) FilesUsedFromContext(
	config *v1.Config, buildArgs *dockerfile.BuildArgs) ([]string, error)

FilesUsedFromContext returns the list of files used from the build context.

func (*CachingCopyCommand) From

func (cr *CachingCopyCommand) From() string

From returns the base image name for multi-stage builds.

func (CachingCopyCommand) Layer

func (c CachingCopyCommand) Layer() v1.Layer

func (*CachingCopyCommand) MetadataOnly

func (cr *CachingCopyCommand) MetadataOnly() bool

MetadataOnly returns false as caching COPY command modifies the filesystem.

func (*CachingCopyCommand) String

func (cr *CachingCopyCommand) String() string

type CachingRunCommand

type CachingRunCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

CachingRunCommand implements caching for RUN instructions It handles extracting cached layers instead of executing commands

func (*CachingRunCommand) ExecuteCommand

func (cr *CachingRunCommand) ExecuteCommand(_ *v1.Config, _ *dockerfile.BuildArgs) error

ExecuteCommand handles cached RUN instruction execution by extracting pre-computed layers instead of running the command

func (*CachingRunCommand) FilesToSnapshot

func (cr *CachingRunCommand) FilesToSnapshot() []string

FilesToSnapshot returns the list of files extracted from cached layers

func (*CachingRunCommand) IsArgsEnvsRequiredInCache

func (cr *CachingRunCommand) IsArgsEnvsRequiredInCache() bool

IsArgsEnvsRequiredInCache indicates whether arguments and environment variables are required for caching this command

func (CachingRunCommand) Layer

func (c CachingRunCommand) Layer() v1.Layer

func (*CachingRunCommand) MetadataOnly

func (cr *CachingRunCommand) MetadataOnly() bool

MetadataOnly indicates whether this cached command only affects metadata

func (*CachingRunCommand) String

func (cr *CachingRunCommand) String() string

String returns string representation of the cached RUN command

type CmdCommand

type CmdCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

CmdCommand represents the CMD Dockerfile instruction which specifies the default command to run in a container

func (*CmdCommand) ExecuteCommand

func (c *CmdCommand) ExecuteCommand(config *v1.Config, _ *dockerfile.BuildArgs) error

ExecuteCommand executes the CMD command Argument handling is the same as RUN.

func (*CmdCommand) String

func (c *CmdCommand) String() string

String returns some information about the command for the image config history

type CommandType

type CommandType interface {
	*CopyCommand | *CachingCopyCommand
}

CommandType represents the type of command that can be cast to AbstractCopyCommand. This constraint ensures type safety when casting commands to AbstractCopyCommand.

type CommonCommandHelper

type CommonCommandHelper struct{}

CommonCommandHelper provides common functionality for all commands

func NewCommonCommandHelper

func NewCommonCommandHelper() *CommonCommandHelper

NewCommonCommandHelper creates a new common command helper

func (*CommonCommandHelper) CreateDirectoryWithPermissions

func (h *CommonCommandHelper) CreateDirectoryWithPermissions(path string, mode os.FileMode, uid, gid int64) error

CreateDirectoryWithPermissions creates a directory with proper permissions and user/group ownership

func (*CommonCommandHelper) GetUserGroupFromConfig

func (h *CommonCommandHelper) GetUserGroupFromConfig(
	cfg *v1.Config, replacementEnvs []string) (uid, gid int64, err error)

GetUserGroupFromConfig gets user and group from config with common error handling

func (*CommonCommandHelper) HandleCommandError

func (h *CommonCommandHelper) HandleCommandError(operation string, err error) error

HandleCommandError handles command errors with common error wrapping

func (*CommonCommandHelper) LogCommandExecution

func (h *CommonCommandHelper) LogCommandExecution(cmdName string, details ...string)

LogCommandExecution logs command execution with common format

func (*CommonCommandHelper) ResolveEnvironmentVariable

func (h *CommonCommandHelper) ResolveEnvironmentVariable(
	value string, replacementEnvs []string, allowEmpty bool) (string, error)

ResolveEnvironmentVariable resolves a single environment variable with common error handling

func (*CommonCommandHelper) ResolveSourcesAndDestination

func (h *CommonCommandHelper) ResolveSourcesAndDestination(
	cmd *instructions.CopyCommand,
	fileContext util.FileContext,
	replacementEnvs []string) (sources []string, destination string, err error)

ResolveSourcesAndDestination resolves sources and destination with common error handling

func (*CommonCommandHelper) ResolveUserFromConfig

func (h *CommonCommandHelper) ResolveUserFromConfig(
	cfg *v1.Config, buildArgs *dockerfile.BuildArgs) (userStr string, err error)

ResolveUserFromConfig resolves user from config with common error handling

func (*CommonCommandHelper) ResolveWorkingDirectory

func (h *CommonCommandHelper) ResolveWorkingDirectory(
	workdirPath, currentWorkingDir string, replacementEnvs []string) (string, error)

ResolveWorkingDirectory resolves working directory path with proper handling of absolute/relative paths

func (*CommonCommandHelper) SetupFileContext

func (h *CommonCommandHelper) SetupFileContext(
	cmd *instructions.CopyCommand, fileContext util.FileContext) util.FileContext

SetupFileContext sets up file context for commands that need it

func (*CommonCommandHelper) SetupFilePermissions

func (h *CommonCommandHelper) SetupFilePermissions(
	chmod string, replacementEnvs []string) (mode os.FileMode, useDefault bool, err error)

SetupFilePermissions sets up file permissions with common error handling

func (*CommonCommandHelper) SetupUserGroup

func (h *CommonCommandHelper) SetupUserGroup(chown string, replacementEnvs []string) (uid, gid int64, err error)

SetupUserGroup sets up user and group from chown string with common error handling

func (*CommonCommandHelper) ValidateCommandArguments

func (h *CommonCommandHelper) ValidateCommandArguments(args []string) error

ValidateCommandArguments validates command arguments for security

func (*CommonCommandHelper) ValidatePath

func (h *CommonCommandHelper) ValidatePath(path string) error

ValidatePath validates a path to prevent directory traversal and other security issues

type CommonCommandInterface

type CommonCommandInterface interface {
	ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error
	String() string
	FilesToSnapshot() []string
	FilesUsedFromContext(config *v1.Config, buildArgs *dockerfile.BuildArgs) ([]string, error)
	MetadataOnly() bool
	RequiresUnpackedFS() bool
}

CommonCommandInterface defines common interface for all commands

type CopyCommand

type CopyCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

CopyCommand implements the COPY Dockerfile instruction.

func (*CopyCommand) CacheCommand

func (c *CopyCommand) CacheCommand(img v1.Image) DockerCommand

CacheCommand returns true since this command should be cached

func (*CopyCommand) ExecuteCommand

func (c *CopyCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand executes the COPY command by copying files from source to destination.

func (*CopyCommand) FilesToSnapshot

func (c *CopyCommand) FilesToSnapshot() []string

FilesToSnapshot should return an empty array if still nil; no files were changed

func (*CopyCommand) FilesUsedFromContext

func (c *CopyCommand) FilesUsedFromContext(config *v1.Config, buildArgs *dockerfile.BuildArgs) ([]string, error)

FilesUsedFromContext returns the list of files used from the build context.

func (*CopyCommand) From

func (c *CopyCommand) From() string

From returns the base image name for multi-stage builds.

func (*CopyCommand) MetadataOnly

func (c *CopyCommand) MetadataOnly() bool

MetadataOnly returns false as COPY command modifies the filesystem.

func (*CopyCommand) RequiresUnpackedFS

func (c *CopyCommand) RequiresUnpackedFS() bool

RequiresUnpackedFS returns true as COPY command requires an unpacked filesystem.

func (*CopyCommand) ShouldCacheOutput

func (c *CopyCommand) ShouldCacheOutput() bool

ShouldCacheOutput returns whether the command output should be cached.

func (*CopyCommand) String

func (c *CopyCommand) String() string

String returns some information about the command for the image config

type CurrentCacheKey

type CurrentCacheKey func() (string, error)

CurrentCacheKey is a function type that returns the current cache key

type DockerCommand

type DockerCommand interface {
	// ExecuteCommand is responsible for:
	// 	1. Making required changes to the filesystem (ex. copying files for ADD/COPY or setting ENV variables)
	//  2. Updating metadata fields in the config
	// It should not change the config history.
	ExecuteCommand(*v1.Config, *dockerfile.BuildArgs) error
	// Returns a string representation of the command
	String() string
	// A list of files to snapshot, empty for metadata commands or nil if we don't know
	FilesToSnapshot() []string

	// ProvidesFileToSnapshot is true for all metadata commands and commands which know
	// list of files changed. False for Run command.
	ProvidesFilesToSnapshot() bool

	// Return a cache-aware implementation of this command, if it exists.
	CacheCommand(v1.Image) DockerCommand

	// Return true if this command depends on the build context.
	FilesUsedFromContext(*v1.Config, *dockerfile.BuildArgs) ([]string, error)

	MetadataOnly() bool

	RequiresUnpackedFS() bool

	// Whether the output layer of this command should be cached in and
	// retrieved from the layer cache.
	ShouldCacheOutput() bool

	// ShouldDetectDeletedFiles returns true if the command could delete files.
	ShouldDetectDeletedFiles() bool

	// True if need add ARGs and EVNs to composite cache string with resolved command
	// need only for RUN instruction
	IsArgsEnvsRequiredInCache() bool
}

DockerCommand is the interface that all Dockerfile command implementations must satisfy

func GetCommand

func GetCommand(cmd instructions.Command, fileContext util.FileContext,
	useNewRun, cacheCopy, cacheRun bool) (DockerCommand, error)

GetCommand creates the appropriate DockerCommand implementation based on the instruction type

type EntrypointCommand

type EntrypointCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

EntrypointCommand implements the Dockerfile ENTRYPOINT instruction

func (*EntrypointCommand) ExecuteCommand

func (e *EntrypointCommand) ExecuteCommand(config *v1.Config, _ *dockerfile.BuildArgs) error

ExecuteCommand handles command processing similar to CMD and RUN,

func (*EntrypointCommand) String

func (e *EntrypointCommand) String() string

String returns some information about the command for the image config history

type EnvCommand

type EnvCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

EnvCommand represents the ENV Dockerfile instruction which sets environment variables in the container image

func (*EnvCommand) ExecuteCommand

func (e *EnvCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand processes the ENV instruction by setting environment variables in the container configuration using build arguments replacement

func (*EnvCommand) String

func (e *EnvCommand) String() string

String returns some information about the command for the image config history

type ExposeCommand

type ExposeCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

ExposeCommand implements the Dockerfile EXPOSE instruction It handles exposing ports in the container configuration

func (*ExposeCommand) ExecuteCommand

func (r *ExposeCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand processes the EXPOSE instruction by adding exposed ports to the container configuration

func (*ExposeCommand) String

func (r *ExposeCommand) String() string

type HealthCheckCommand

type HealthCheckCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

HealthCheckCommand implements the Dockerfile HEALTHCHECK instruction

func (*HealthCheckCommand) ExecuteCommand

func (h *HealthCheckCommand) ExecuteCommand(config *v1.Config, _ *dockerfile.BuildArgs) error

ExecuteCommand handles command processing similar to CMD and RUN,

func (*HealthCheckCommand) String

func (h *HealthCheckCommand) String() string

String returns some information about the command for the image config history

type LabelCommand

type LabelCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

LabelCommand implements the Dockerfile LABEL instruction

func (*LabelCommand) ExecuteCommand

func (r *LabelCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand processes the LABEL instruction by updating image labels

func (*LabelCommand) String

func (r *LabelCommand) String() string

String returns some information about the command for the image config history

type OnBuildCommand

type OnBuildCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

OnBuildCommand implements the Dockerfile ONBUILD instruction It handles storing commands to be executed when the image is used as a base

func (*OnBuildCommand) ExecuteCommand

func (o *OnBuildCommand) ExecuteCommand(config *v1.Config, _ *dockerfile.BuildArgs) error

ExecuteCommand adds the specified expression in Onbuild to the config

func (*OnBuildCommand) String

func (o *OnBuildCommand) String() string

String returns some information about the command for the image config history

type RunCommand

type RunCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

RunCommand implements the Dockerfile RUN instruction It handles executing shell commands during the build process

func (*RunCommand) CacheCommand

func (r *RunCommand) CacheCommand(img v1.Image) DockerCommand

CacheCommand returns true since this command should be cached

func (*RunCommand) ExecuteCommand

func (r *RunCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand executes the RUN instruction by preparing and running the command with proper environment setup and security validation

func (*RunCommand) FilesToSnapshot

func (r *RunCommand) FilesToSnapshot() []string

FilesToSnapshot returns the list of files that should be snapshotted after command execution

func (*RunCommand) IsArgsEnvsRequiredInCache

func (r *RunCommand) IsArgsEnvsRequiredInCache() bool

IsArgsEnvsRequiredInCache indicates whether arguments and environment variables are required for caching this command

func (*RunCommand) MetadataOnly

func (r *RunCommand) MetadataOnly() bool

MetadataOnly indicates whether this command only affects metadata (not filesystem)

func (*RunCommand) ProvidesFilesToSnapshot

func (r *RunCommand) ProvidesFilesToSnapshot() bool

ProvidesFilesToSnapshot indicates whether this command provides files for snapshotting

func (*RunCommand) RequiresUnpackedFS

func (r *RunCommand) RequiresUnpackedFS() bool

RequiresUnpackedFS indicates whether this command requires an unpacked filesystem

func (*RunCommand) ShouldCacheOutput

func (r *RunCommand) ShouldCacheOutput() bool

ShouldCacheOutput indicates whether the output of this command should be cached

func (*RunCommand) String

func (r *RunCommand) String() string

String returns some information about the command for the image config

type RunMarkerCommand

type RunMarkerCommand struct {
	BaseCommand

	Files []string
	// contains filtered or unexported fields
}

RunMarkerCommand represents a specialized RUN command that tracks file system changes by creating markers and detecting modified files during execution

func (*RunMarkerCommand) CacheCommand

func (r *RunMarkerCommand) CacheCommand(img v1.Image) DockerCommand

CacheCommand creates a caching version of this RUN command for efficient layer caching and reuse in subsequent builds

func (*RunMarkerCommand) ExecuteCommand

func (r *RunMarkerCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand runs the RUN command and tracks file system changes by comparing the state before and after command execution

func (*RunMarkerCommand) FilesToSnapshot

func (r *RunMarkerCommand) FilesToSnapshot() []string

FilesToSnapshot returns the list of files that were modified during command execution and should be included in the filesystem snapshot

func (*RunMarkerCommand) IsArgsEnvsRequiredInCache

func (r *RunMarkerCommand) IsArgsEnvsRequiredInCache() bool

IsArgsEnvsRequiredInCache indicates whether command arguments and environment variables should be considered for cache key generation

func (*RunMarkerCommand) MetadataOnly

func (r *RunMarkerCommand) MetadataOnly() bool

MetadataOnly indicates whether this command only affects metadata without modifying the filesystem contents

func (*RunMarkerCommand) ProvidesFilesToSnapshot

func (r *RunMarkerCommand) ProvidesFilesToSnapshot() bool

ProvidesFilesToSnapshot indicates whether this command provides files for snapshotting

func (*RunMarkerCommand) RequiresUnpackedFS

func (r *RunMarkerCommand) RequiresUnpackedFS() bool

RequiresUnpackedFS indicates whether this command requires an unpacked filesystem to execute properly

func (*RunMarkerCommand) ShouldCacheOutput

func (r *RunMarkerCommand) ShouldCacheOutput() bool

ShouldCacheOutput indicates whether the output of this command should be cached

func (*RunMarkerCommand) ShouldDetectDeletedFiles

func (r *RunMarkerCommand) ShouldDetectDeletedFiles() bool

ShouldDetectDeletedFiles indicates whether this command should detect and track files that were deleted during execution

func (*RunMarkerCommand) String

func (r *RunMarkerCommand) String() string

String returns some information about the command for the image config

type ShellCommand

type ShellCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

ShellCommand implements the Dockerfile SHELL instruction

func (*ShellCommand) ExecuteCommand

func (s *ShellCommand) ExecuteCommand(config *v1.Config, _ *dockerfile.BuildArgs) error

ExecuteCommand handles command processing similar to CMD and RUN,

func (*ShellCommand) String

func (s *ShellCommand) String() string

String returns some information about the command for the image config history

type StopSignalCommand

type StopSignalCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

StopSignalCommand implements the Dockerfile STOPSIGNAL instruction

func (*StopSignalCommand) ExecuteCommand

func (s *StopSignalCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand handles command processing similar to CMD and RUN,

func (*StopSignalCommand) String

func (s *StopSignalCommand) String() string

String returns some information about the command for the image config history

type UserCommand

type UserCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

UserCommand implements the Dockerfile USER instruction

func (*UserCommand) ExecuteCommand

func (r *UserCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand processes the USER instruction by setting the user/group for subsequent commands

func (*UserCommand) String

func (r *UserCommand) String() string

type VolumeCommand

type VolumeCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

VolumeCommand represents the VOLUME Dockerfile instruction which creates mount points for external storage

func (*VolumeCommand) ExecuteCommand

func (v *VolumeCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand processes the VOLUME instruction by creating directories and configuring volume mount points in the container image

func (*VolumeCommand) FilesToSnapshot

func (v *VolumeCommand) FilesToSnapshot() []string

FilesToSnapshot returns an empty array since VOLUME command doesn't modify files that need to be included in snapshots

func (*VolumeCommand) String

func (v *VolumeCommand) String() string

type WorkdirCommand

type WorkdirCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

WorkdirCommand represents the WORKDIR Dockerfile instruction which sets the working directory for subsequent instructions

func (*WorkdirCommand) ExecuteCommand

func (w *WorkdirCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand processes the WORKDIR instruction by setting the working directory and creating the directory if it doesn't exist with appropriate permissions

func (*WorkdirCommand) FilesToSnapshot

func (w *WorkdirCommand) FilesToSnapshot() []string

FilesToSnapshot returns the workingdir, which should have been created if it didn't already exist

func (*WorkdirCommand) MetadataOnly

func (w *WorkdirCommand) MetadataOnly() bool

MetadataOnly indicates whether this command only affects metadata without modifying the filesystem contents

func (*WorkdirCommand) String

func (w *WorkdirCommand) String() string

String returns some information about the command for the image config history

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL