Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…velopment into main
  • Loading branch information
maxisses committed Feb 26, 2022
2 parents 52baf4d + 7d37f0b commit 1f8ac1c
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
16 changes: 16 additions & 0 deletions snippets/chapter2/startuptime/distroless/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.17 as build-env

WORKDIR /go/src/app
COPY *.go ./

RUN go mod init
RUN go get -d -v ./...
RUN go vet -v
RUN go test -v

RUN CGO_ENABLED=0 go build -o /go/bin/app

FROM gcr.io/distroless/static

COPY --from=build-env /go/bin/app /
CMD ["/app"]
2 changes: 2 additions & 0 deletions snippets/chapter2/startuptime/distroless/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This folder contains a copy from the following git repository folder https://github.com/GoogleContainerTools/distroless/tree/main/examples/go
We changed the Dockerfile from "COPY *.go ." to "COPY *.go ./" to address an issue with failing builds.
21 changes: 21 additions & 0 deletions snippets/chapter2/startuptime/distroless/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2017 Google Inc. All rights reserved.

// 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 main

import "fmt"

func main() {
fmt.Println("Hello, world!")
}
8 changes: 8 additions & 0 deletions snippets/chapter2/startuptime/distroless/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package main

import (
"testing"
)

func Test1(t *testing.T) {
}

0 comments on commit 1f8ac1c

Please sign in to comment.