FROM golang:1.13.3-alpine3.10 as builder
WORKDIR /go/src/code.justin.tv/eventbus/controlplane
COPY . .
RUN go install ./cmd/httpserver

FROM alpine:3.10
EXPOSE 6888 8888
RUN apk update && apk upgrade && apk add --no-cache ca-certificates curl bash && apk add --no-cache coreutils
RUN echo "Fetching wait-for-it"
RUN curl -s -o /wait-for-it.sh https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && chmod 777 /wait-for-it.sh
RUN update-ca-certificates 2>/dev/null || true
COPY --from=builder /go/bin/httpserver /bin/httpserver
CMD ["httpserver"]  
