Skip to content

Commit 7d6591f

Browse files
authored
Add registry mirror environment variable (#114)
1 parent c727288 commit 7d6591f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

envbuilder.go

+9
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,10 @@ func Run(ctx context.Context, options Options) error {
625625

626626
endStage := startStage("🏗️ Building image...")
627627
// At this point we have all the context, we can now build!
628+
registryMirror := []string{}
629+
if val, ok := os.LookupEnv("KANIKO_REGISTRY_MIRROR"); ok {
630+
registryMirror = strings.Split(val, ";")
631+
}
628632
image, err := executor.DoBuild(&config.KanikoOptions{
629633
// Boilerplate!
630634
CustomPlatform: platforms.Format(platforms.Normalize(platforms.DefaultSpec())),
@@ -656,6 +660,11 @@ func Run(ctx context.Context, options Options) error {
656660
Insecure: options.Insecure,
657661
InsecurePull: options.Insecure,
658662
SkipTLSVerify: options.Insecure,
663+
// Enables registry mirror features in Kaniko, see more in link below
664+
// https://github.com/GoogleContainerTools/kaniko?tab=readme-ov-file#flag---registry-mirror
665+
// Related to PR #114
666+
// https://github.com/coder/envbuilder/pull/114
667+
RegistryMirrors: registryMirror,
659668
},
660669
SrcContext: buildParams.BuildContext,
661670
})

0 commit comments

Comments
 (0)