# Build tern
FROM golang:1.18-alpine3.15 AS tern
RUN apk --no-cache add git
RUN go get -u github.com/jackc/tern

# Build final image
FROM alpine:3.15
RUN apk --no-cache add git perl-app-cpanminus postgresql-client
RUN cpanm --no-wget TAP::Parser::SourceHandler::pgTAP
RUN addgroup -S db-tests && adduser -S db-tests -G db-tests
COPY --from=tern /go/bin/tern /usr/local/bin
