Skip to content

Commit

Permalink
Update base image to ghcr.io/distroless/static:latest
Browse files Browse the repository at this point in the history
  • Loading branch information
imjasonh committed Jun 29, 2022
1 parent 79a463d commit 2bfd7ea
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/commands/options/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (

const (
// configDefaultBaseImage is the default base image if not specified in .ko.yaml.
configDefaultBaseImage = "gcr.io/distroless/static:nonroot"
configDefaultBaseImage = "ghcr.io/distroless/static:latest"
)

// BuildOptions represents options for the ko builder.
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/options/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestDefaultBaseImage(t *testing.T) {
t.Fatal(err)
}

wantDefaultBaseImage := "gcr.io/distroless/base:nonroot" // matches value in ./testdata/.ko.yaml
wantDefaultBaseImage := "alpine" // matches value in ./testdata/config/.ko.yaml
if bo.BaseImage != wantDefaultBaseImage {
t.Fatalf("wanted BaseImage %s, got %s", wantDefaultBaseImage, bo.BaseImage)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/options/testdata/config/.ko.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
defaultBaseImage: gcr.io/distroless/base:nonroot
defaultBaseImage: alpine
10 changes: 10 additions & 0 deletions test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ package main

import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"os/signal"
"path/filepath"
"syscall"
"time"

// Give this an interesting import
_ "github.com/google/go-containerregistry/pkg/registry"
Expand All @@ -40,6 +42,14 @@ func main() {

log.Println("version =", version)

// Exercise timezone conversions, which demonstrates tzdata is provided
// by the base image.
now := time.Now()
loc, _ := time.LoadLocation("UTC")
fmt.Printf("UTC Time: %s\n", now.In(loc))
loc, _ = time.LoadLocation("America/New_York")
fmt.Printf("New York Time: %s\n", now.In(loc))

dp := os.Getenv("KO_DATA_PATH")
file := filepath.Join(dp, *f)
bytes, err := ioutil.ReadFile(file)
Expand Down

0 comments on commit 2bfd7ea

Please sign in to comment.