FROM golang:1.14-alpine as build
WORKDIR /go/src/code.justin.tv/devhub/e2topics
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -o main .


FROM alpine:latest as run
LABEL maintainer="Mario Izquierdo <marioiz@twitch.tv>"
WORKDIR /e2topics
# 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/e2topics/main .
ENTRYPOINT ["./main"]
