# The builder and linter for this repository
# Notice how we depend upon nothing twitch specific: just pulling the core golang docker image
FROM golang:1.12.5

# Go modules don't need to be in GOPATH.  Just build/test inside app
WORKDIR /app

# Copy `go.mod` for definitions and `go.sum` to invalidate the next layer
# in case of a change in the dependencies
COPY go.mod go.sum ./
RUN go mod download

# Add our code, build it, test it, etc
COPY . .
# Make sure our code builds
RUN go build -mod=readonly ./...
# Make sure nobody hacked the module repository
RUN go mod verify
