FROM golang:alpine as gobuild

RUN apk add --no-cache git

WORKDIR /go/src/wg-manager

ADD cmd ./

RUN go get -d -v
RUN go build -v


FROM alpine
MAINTAINER Pierre-Olivier Mercier <nemunaire@nemunai.re>

RUN apk add --no-cache --initdb \
    wireguard-tools-wg

EXPOSE 8081

COPY --from=gobuild /go/src/wg-manager/wg-manager /bin/wg-manager

ENTRYPOINT ["/bin/wg-manager"]
