|
@@ -35,7 +35,6 @@ import (
|
|
//
|
|
//
|
|
// Sets the environment variable foo to bar, also makes interpolation
|
|
// Sets the environment variable foo to bar, also makes interpolation
|
|
// in the dockerfile available from the next statement on via ${foo}.
|
|
// in the dockerfile available from the next statement on via ${foo}.
|
|
-//
|
|
|
|
func dispatchEnv(d dispatchRequest, c *instructions.EnvCommand) error {
|
|
func dispatchEnv(d dispatchRequest, c *instructions.EnvCommand) error {
|
|
runConfig := d.state.runConfig
|
|
runConfig := d.state.runConfig
|
|
commitMessage := bytes.NewBufferString("ENV")
|
|
commitMessage := bytes.NewBufferString("ENV")
|
|
@@ -73,7 +72,6 @@ func dispatchMaintainer(d dispatchRequest, c *instructions.MaintainerCommand) er
|
|
// LABEL some json data describing the image
|
|
// LABEL some json data describing the image
|
|
//
|
|
//
|
|
// Sets the Label variable foo to bar,
|
|
// Sets the Label variable foo to bar,
|
|
-//
|
|
|
|
func dispatchLabel(d dispatchRequest, c *instructions.LabelCommand) error {
|
|
func dispatchLabel(d dispatchRequest, c *instructions.LabelCommand) error {
|
|
if d.state.runConfig.Labels == nil {
|
|
if d.state.runConfig.Labels == nil {
|
|
d.state.runConfig.Labels = make(map[string]string)
|
|
d.state.runConfig.Labels = make(map[string]string)
|
|
@@ -90,7 +88,6 @@ func dispatchLabel(d dispatchRequest, c *instructions.LabelCommand) error {
|
|
//
|
|
//
|
|
// Add the file 'foo' to '/path'. Tarball and Remote URL (http, https) handling
|
|
// Add the file 'foo' to '/path'. Tarball and Remote URL (http, https) handling
|
|
// exist here. If you do not wish to have this automatic handling, use COPY.
|
|
// exist here. If you do not wish to have this automatic handling, use COPY.
|
|
-//
|
|
|
|
func dispatchAdd(d dispatchRequest, c *instructions.AddCommand) error {
|
|
func dispatchAdd(d dispatchRequest, c *instructions.AddCommand) error {
|
|
if c.Chmod != "" {
|
|
if c.Chmod != "" {
|
|
return errors.New("the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled")
|
|
return errors.New("the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled")
|
|
@@ -112,7 +109,6 @@ func dispatchAdd(d dispatchRequest, c *instructions.AddCommand) error {
|
|
// COPY foo /path
|
|
// COPY foo /path
|
|
//
|
|
//
|
|
// Same as 'ADD' but without the tar and remote url handling.
|
|
// Same as 'ADD' but without the tar and remote url handling.
|
|
-//
|
|
|
|
func dispatchCopy(d dispatchRequest, c *instructions.CopyCommand) error {
|
|
func dispatchCopy(d dispatchRequest, c *instructions.CopyCommand) error {
|
|
if c.Chmod != "" {
|
|
if c.Chmod != "" {
|
|
return errors.New("the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled")
|
|
return errors.New("the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled")
|
|
@@ -157,7 +153,6 @@ func (d *dispatchRequest) getImageMount(imageRefOrID string) (*imageMount, error
|
|
}
|
|
}
|
|
|
|
|
|
// FROM [--platform=platform] imagename[:tag | @digest] [AS build-stage-name]
|
|
// FROM [--platform=platform] imagename[:tag | @digest] [AS build-stage-name]
|
|
-//
|
|
|
|
func initializeStage(d dispatchRequest, cmd *instructions.Stage) error {
|
|
func initializeStage(d dispatchRequest, cmd *instructions.Stage) error {
|
|
d.builder.imageProber.Reset()
|
|
d.builder.imageProber.Reset()
|
|
|
|
|
|
@@ -304,7 +299,6 @@ func dispatchOnbuild(d dispatchRequest, c *instructions.OnbuildCommand) error {
|
|
// WORKDIR /tmp
|
|
// WORKDIR /tmp
|
|
//
|
|
//
|
|
// Set the working directory for future RUN/CMD/etc statements.
|
|
// Set the working directory for future RUN/CMD/etc statements.
|
|
-//
|
|
|
|
func dispatchWorkdir(d dispatchRequest, c *instructions.WorkdirCommand) error {
|
|
func dispatchWorkdir(d dispatchRequest, c *instructions.WorkdirCommand) error {
|
|
runConfig := d.state.runConfig
|
|
runConfig := d.state.runConfig
|
|
var err error
|
|
var err error
|
|
@@ -347,7 +341,6 @@ func dispatchWorkdir(d dispatchRequest, c *instructions.WorkdirCommand) error {
|
|
// RUN echo hi # sh -c echo hi (Linux and LCOW)
|
|
// RUN echo hi # sh -c echo hi (Linux and LCOW)
|
|
// RUN echo hi # cmd /S /C echo hi (Windows)
|
|
// RUN echo hi # cmd /S /C echo hi (Windows)
|
|
// RUN [ "echo", "hi" ] # echo hi
|
|
// RUN [ "echo", "hi" ] # echo hi
|
|
-//
|
|
|
|
func dispatchRun(d dispatchRequest, c *instructions.RunCommand) error {
|
|
func dispatchRun(d dispatchRequest, c *instructions.RunCommand) error {
|
|
if !system.IsOSSupported(d.state.operatingSystem) {
|
|
if !system.IsOSSupported(d.state.operatingSystem) {
|
|
return system.ErrNotSupportedOperatingSystem
|
|
return system.ErrNotSupportedOperatingSystem
|
|
@@ -442,7 +435,6 @@ func prependEnvOnCmd(buildArgs *BuildArgs, buildArgVars []string, cmd strslice.S
|
|
//
|
|
//
|
|
// Set the default command to run in the container (which may be empty).
|
|
// Set the default command to run in the container (which may be empty).
|
|
// Argument handling is the same as RUN.
|
|
// Argument handling is the same as RUN.
|
|
-//
|
|
|
|
func dispatchCmd(d dispatchRequest, c *instructions.CmdCommand) error {
|
|
func dispatchCmd(d dispatchRequest, c *instructions.CmdCommand) error {
|
|
runConfig := d.state.runConfig
|
|
runConfig := d.state.runConfig
|
|
cmd, argsEscaped := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem, c.Name(), c.String())
|
|
cmd, argsEscaped := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem, c.Name(), c.String())
|
|
@@ -473,7 +465,6 @@ func dispatchCmd(d dispatchRequest, c *instructions.CmdCommand) error {
|
|
//
|
|
//
|
|
// Set the default healthcheck command to run in the container (which may be empty).
|
|
// Set the default healthcheck command to run in the container (which may be empty).
|
|
// Argument handling is the same as RUN.
|
|
// Argument handling is the same as RUN.
|
|
-//
|
|
|
|
func dispatchHealthcheck(d dispatchRequest, c *instructions.HealthCheckCommand) error {
|
|
func dispatchHealthcheck(d dispatchRequest, c *instructions.HealthCheckCommand) error {
|
|
runConfig := d.state.runConfig
|
|
runConfig := d.state.runConfig
|
|
if runConfig.Healthcheck != nil {
|
|
if runConfig.Healthcheck != nil {
|
|
@@ -493,7 +484,6 @@ func dispatchHealthcheck(d dispatchRequest, c *instructions.HealthCheckCommand)
|
|
//
|
|
//
|
|
// Handles command processing similar to CMD and RUN, only req.runConfig.Entrypoint
|
|
// Handles command processing similar to CMD and RUN, only req.runConfig.Entrypoint
|
|
// is initialized at newBuilder time instead of through argument parsing.
|
|
// is initialized at newBuilder time instead of through argument parsing.
|
|
-//
|
|
|
|
func dispatchEntrypoint(d dispatchRequest, c *instructions.EntrypointCommand) error {
|
|
func dispatchEntrypoint(d dispatchRequest, c *instructions.EntrypointCommand) error {
|
|
runConfig := d.state.runConfig
|
|
runConfig := d.state.runConfig
|
|
cmd, argsEscaped := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem, c.Name(), c.String())
|
|
cmd, argsEscaped := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem, c.Name(), c.String())
|
|
@@ -523,7 +513,6 @@ func dispatchEntrypoint(d dispatchRequest, c *instructions.EntrypointCommand) er
|
|
//
|
|
//
|
|
// Expose ports for links and port mappings. This all ends up in
|
|
// Expose ports for links and port mappings. This all ends up in
|
|
// req.runConfig.ExposedPorts for runconfig.
|
|
// req.runConfig.ExposedPorts for runconfig.
|
|
-//
|
|
|
|
func dispatchExpose(d dispatchRequest, c *instructions.ExposeCommand, envs []string) error {
|
|
func dispatchExpose(d dispatchRequest, c *instructions.ExposeCommand, envs []string) error {
|
|
// custom multi word expansion
|
|
// custom multi word expansion
|
|
// expose $FOO with FOO="80 443" is expanded as EXPOSE [80,443]. This is the only command supporting word to words expansion
|
|
// expose $FOO with FOO="80 443" is expanded as EXPOSE [80,443]. This is the only command supporting word to words expansion
|
|
@@ -557,7 +546,6 @@ func dispatchExpose(d dispatchRequest, c *instructions.ExposeCommand, envs []str
|
|
//
|
|
//
|
|
// Set the user to 'foo' for future commands and when running the
|
|
// Set the user to 'foo' for future commands and when running the
|
|
// ENTRYPOINT/CMD at container run time.
|
|
// ENTRYPOINT/CMD at container run time.
|
|
-//
|
|
|
|
func dispatchUser(d dispatchRequest, c *instructions.UserCommand) error {
|
|
func dispatchUser(d dispatchRequest, c *instructions.UserCommand) error {
|
|
d.state.runConfig.User = c.User
|
|
d.state.runConfig.User = c.User
|
|
return d.builder.commit(d.state, fmt.Sprintf("USER %v", c.User))
|
|
return d.builder.commit(d.state, fmt.Sprintf("USER %v", c.User))
|
|
@@ -566,7 +554,6 @@ func dispatchUser(d dispatchRequest, c *instructions.UserCommand) error {
|
|
// VOLUME /foo
|
|
// VOLUME /foo
|
|
//
|
|
//
|
|
// Expose the volume /foo for use. Will also accept the JSON array form.
|
|
// Expose the volume /foo for use. Will also accept the JSON array form.
|
|
-//
|
|
|
|
func dispatchVolume(d dispatchRequest, c *instructions.VolumeCommand) error {
|
|
func dispatchVolume(d dispatchRequest, c *instructions.VolumeCommand) error {
|
|
if d.state.runConfig.Volumes == nil {
|
|
if d.state.runConfig.Volumes == nil {
|
|
d.state.runConfig.Volumes = map[string]struct{}{}
|
|
d.state.runConfig.Volumes = map[string]struct{}{}
|