FROM golang:1.12.5 as builder

LABEL maintainer="Luis <NAME> <<EMAIL>>"

RUN mkdir -p /auth/data

WORKDIR $HOME/proyectos/auth

COPY . .

RUN go get -d -v ./...

RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /go/bin/auth .

FROM alpine:latest

RUN apk --no-cache add ca-certificates

WORKDIR /root/

COPY --from=builder /go/bin/auth .

EXPOSE 443

VOLUME ["/auth/data"]

CMD ["./auth","-cert","/auth/data/cert.pem","-key","/auth/data/key.pem","-store","/auth/data/store.json"]
