FROM golang:1.12.4-alpine as base
MAINTAINER Andrew Swistak <andrew@andrewswistak.com>

RUN mkdir -p /go/src/github.com/ajswis/go-pkparse-server
WORKDIR /go/src/github.com/ajswis/go-pkparse-server

################################################################################
FROM base as builder

COPY . /go/src/github.com/ajswis/go-pkparse-server
RUN go build .

################################################################################
FROM base as prod

COPY --from=builder /go/src/github.com/ajswis/go-pkparse-server/go-pkparse-server .

ENV GIN_MODE=release
CMD ./go-pkparse-server
