27 lines
521 B
Docker
27 lines
521 B
Docker
FROM golang:1.13-stretch as builder
|
|
WORKDIR /go/src/github.com/jaypipes/ghw
|
|
|
|
# Force the go compiler to use modules.
|
|
ENV GO111MODULE=on
|
|
ENV GOPROXY=direct
|
|
|
|
# go.mod and go.sum go into their own layers.
|
|
COPY go.mod .
|
|
COPY go.sum .
|
|
|
|
# This ensures `go mod download` happens only when go.mod and go.sum change.
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN CGO_ENABLED=0 go build -o ghwc ./cmd/ghwc/
|
|
|
|
FROM alpine:3.7
|
|
RUN apk add --no-cache ethtool
|
|
|
|
WORKDIR /bin
|
|
|
|
COPY --from=builder /go/src/github.com/jaypipes/ghw/ghwc /bin
|
|
|
|
CMD ghwc
|