-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Priya Wadhwa
committed
May 9, 2018
1 parent
3aafb84
commit 5396143
Showing
37 changed files
with
296 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
FROM gcr.io/kaniko-test/onbuild-base:latest | ||
COPY context/foo foo | ||
ENV dir /new/workdir/ | ||
ONBUILD RUN echo "onbuild" > /tmp/onbuild | ||
ARG file | ||
ONBUILD RUN echo "onbuild" > $file | ||
ONBUILD RUN echo "onbuild 2" > ${dir} | ||
ONBUILD WORKDIR /new/workdir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
FROM scratch | ||
ADD context/foo /foo | ||
ENV hello hello | ||
ADD context/foo /$hello | ||
# First, make sure simple arg replacement works | ||
ARG file | ||
COPY $file /foo | ||
# Check that setting a default value works | ||
ARG file2=context/bar/bat | ||
COPY $file2 /bat | ||
# Check that overriding a default value works | ||
ARG file3=context/bar/baz | ||
COPY $file3 /baz | ||
# Check that setting an ENV will override the ARG | ||
ENV file context/bar/bam/bat | ||
COPY $file /env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
Copyright 2018 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package commands | ||
|
||
import ( | ||
"github.com/docker/docker/builder/dockerfile" | ||
"github.com/docker/docker/builder/dockerfile/instructions" | ||
"github.com/google/go-containerregistry/v1" | ||
"github.com/sirupsen/logrus" | ||
"strings" | ||
) | ||
|
||
type ArgCommand struct { | ||
cmd *instructions.ArgCommand | ||
} | ||
|
||
// ExecuteCommand only needs to add this ARG key/value as seen | ||
func (r *ArgCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error { | ||
logrus.Info("ARG") | ||
buildArgs.AddArg(r.cmd.Key, r.cmd.Value) | ||
return nil | ||
} | ||
|
||
// FilesToSnapshot returns an empty array since this command only touches metadata. | ||
func (r *ArgCommand) FilesToSnapshot() []string { | ||
return []string{} | ||
} | ||
|
||
// CreatedBy returns some information about the command for the image config history | ||
func (r *ArgCommand) CreatedBy() string { | ||
return strings.Join([]string{r.cmd.Name(), r.cmd.Key}, " ") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.