Skip to content

Commit 694fd1d

Browse files
committed
Dockerfile: update for go modules
- Build outside the implicit $GOPATH provided by golang:1.12.1. This enables module mode without an ENV line - Switch to go mod download to populate the build cache Signed-off-by: Dave Cheney <[email protected]>
1 parent 8c6e63b commit 694fd1d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
FROM golang:1.12.1 AS build
2-
WORKDIR /go/src/github.com/heptio/contour
2+
WORKDIR /contour
33

4-
ENV GO111MODULE on
5-
ENV GOFLAGS -mod=vendor
6-
COPY go.mod go.sum ./
4+
COPY go.mod ./
5+
RUN go mod download
76

87
COPY cmd cmd
98
COPY internal internal
109
COPY apis apis
11-
RUN go mod vendor
1210
RUN CGO_ENABLED=0 GOOS=linux GOFLAGS=-ldflags=-w go build -o /go/bin/contour -ldflags=-s -v github.com/heptio/contour/cmd/contour
1311

1412
FROM scratch AS final

0 commit comments

Comments
 (0)