File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 1- FROM gcr.io/pluralsh/golang:alpine AS cmd
1+ FROM gcr.io/pluralsh/golang:1.18.2-alpine3.15 AS builder
22
3- RUN apk update && apk add --no-cache git build-base
3+ WORKDIR /workspace
4+ # Copy the Go Modules manifests
5+ COPY go.mod go.mod
6+ COPY go.sum go.sum
7+ # cache deps before building and copying source so that we don't need to re-download as much
8+ # and so that source changes don't invalidate our downloaded layer
9+ RUN go mod download
10+
11+ # Copy the go source
12+ COPY cmd/ cmd/
13+ COPY pkg/ pkg/
414
5- WORKDIR $GOPATH/src/plural/
6- COPY . .
7- RUN go build -o /go/bin/plural -ldflags '-s -w' ./cmd/plural/
8- RUN /go/bin/plural --help
15+ # Build
16+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o plural -ldflags '-s -w' ./cmd/plural/
17+
18+ FROM gcr.io/pluralsh/golang:1.18.2-alpine3.15
19+ RUN apk update && apk add --no-cache git build-base
20+ WORKDIR /
21+ COPY --from=builder /workspace/plural /go/bin/
22+ RUN /go/bin/plural --help
You can’t perform that action at this time.
0 commit comments