FROM golang:1.14-alpine as build

WORKDIR /go/src/code.justin.tv/devhub/loadtest
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .

FROM alpine:latest as run
WORKDIR /loadtest
# Allow using https with tsl
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
# Copy the pre-built binary file from the previous stage
COPY --from=build /go/src/code.justin.tv/devhub/loadtest/main .
ENTRYPOINT ["./main"]