Files
kaniko/pkg/constants/constants.go
T
Priya Wadhwa b0b36ed85a Re-add support for .dockerignore file
This PR adds support for the dockerignore file. Previously when kaniko
had support for the dockerignore file, kaniko first went through the
build context and deleted files that were meant to be ignored. This
resulted in a really bad bug where files in user mounted volumes would
be deleted (my bad).

This time around, instead of modifying the build context at all, kaniko
will check if a file should be excluded when executing ADD/COPY
commands. If a file should be excluded (based on the .dockerignore) it
won't be copied over from the buildcontext and shouldn't end up in the
final image.

I also added a .dockerignore file and Dockerfile as an integration test,
which should fail if the dockerignore is not being processed correctly or if files aren't being excluded correctly.
Also, I removed all the integration testing from the previous version of the
dockerignore support.
2018-12-10 15:20:25 -08:00

83 lines
2.4 KiB
Go

/*
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 constants
const (
// DefaultLogLevel is the default log level
DefaultLogLevel = "info"
// RootDir is the path to the root directory
RootDir = "/"
// WorkspaceDir is the path to the workspace directory
WorkspaceDir = "/workspace"
//KanikoDir is the path to the Kaniko directory
KanikoDir = "/kaniko"
WhitelistPath = "/proc/self/mountinfo"
Author = "kaniko"
// DockerfilePath is the path the Dockerfile is copied to
DockerfilePath = "/kaniko/Dockerfile"
// ContextTar is the default name of the tar uploaded to GCS buckets
ContextTar = "context.tar.gz"
// BuildContextDir is the directory a build context will be unpacked into,
// for example, a tarball from a GCS bucket will be unpacked here
BuildContextDir = "/kaniko/buildcontext/"
// KanikoIntermediateStagesDir is where we will store intermediate stages
// as tarballs in case they are needed later on
KanikoIntermediateStagesDir = "/kaniko/stages"
// Various snapshot modes:
SnapshotModeTime = "time"
SnapshotModeFull = "full"
// NoBaseImage is the scratch image
NoBaseImage = "scratch"
GCSBuildContextPrefix = "gs://"
S3BuildContextPrefix = "s3://"
LocalDirBuildContextPrefix = "dir://"
HOME = "HOME"
// DefaultHOMEValue is the default value Docker sets for $HOME
DefaultHOMEValue = "/root"
RootUser = "root"
// Docker command names
Cmd = "cmd"
Entrypoint = "entrypoint"
// Name of the .dockerignore file
Dockerignore = ".dockerignore"
)
// KanikoBuildFiles is the list of files required to build kaniko
var KanikoBuildFiles = []string{"/kaniko/executor",
"/kaniko/ssl/certs/ca-certificates.crt",
"/kaniko/docker-credential-gcr",
"/kaniko/docker-credential-ecr-login",
"/kaniko/.docker/config.json"}
// ScratchEnvVars are the default environment variables needed for a scratch image.
var ScratchEnvVars = []string{"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}