Skip to content

Commit

Permalink
Merge branch 'GoogleContainerTools:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
cristifalcas authored Jun 16, 2022
2 parents 3ce46b8 + b90f683 commit 9b504c3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,16 @@ Follow these steps to get started:

```dockerfile
# Start by building the application.
FROM golang:1.17-bullseye as build
FROM golang:1.18 as build

WORKDIR /go/src/app
ADD . /go/src/app
COPY . .

RUN go get -d -v ./...

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

# Now copy it into our base image.
FROM gcr.io/distroless/base-debian11
FROM gcr.io/distroless/static-debian11
COPY --from=build /go/bin/app /
CMD ["/app"]
```
Expand Down
11 changes: 5 additions & 6 deletions examples/go/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
FROM golang:1.17 as build-env
FROM golang:1.18 as build

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

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

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

FROM gcr.io/distroless/static
FROM gcr.io/distroless/static-debian11

COPY --from=build-env /go/bin/app /
COPY --from=build /go/bin/app /
CMD ["/app"]
3 changes: 3 additions & 0 deletions examples/go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/GoogleContainerTools/distroless/examples/go

go 1.18

0 comments on commit 9b504c3

Please sign in to comment.