Postgres: What is the best way to have pgTAP integrated?

Created on 2 Jul 2017  路  5Comments  路  Source: docker-library/postgres

The pgTAP extension on Debian/Ubuntu is available and maintained by the PostgreSQL Community but there are no Alpine version, yet we do distribute this container in both forms.
What is the best way to have pgTAP integrated directly in the standard extensions? It makes a wonderfull job for testing.

Most helpful comment

Actually looks like I can give them myself. Below there's a Docker image based on postgres:10-alpine with the extension installed and the pg_prove script available to use inside the container.

FROM postgres:10-alpine

ENV PGTAP_VERSION v0.98.0

RUN apk -U add \
    alpine-sdk \
    perl \
 && git clone https://github.com/theory/pgtap \
 && cd pgtap \
 && git checkout ${PGTAP_VERSION} \
 && make \
 && make install


FROM postgres:10-alpine

COPY --from=0 /usr/local/share/postgresql/extension/pgtap* /usr/local/share/postgresql/extension/

RUN apk -U add \
    build-base \
    perl-dev \
 && cpan TAP::Parser::SourceHandler::pgTAP \
 && apk del -r build-base

...which you can now get with docker pull 1maa/postgres:10-alpine

All 5 comments

pgTAP is a separate project from PostgreSQL Server; we try to stick as close to upstream releases as possible. You'll probably need to bring it up with the pgTAP maintainers (or maybe Alpine maintainers) to see if they want to package pgTAP for Alpine Linux. Or you might be able to just build pgTAP from source in an image FROM postgres:9.6-alpine.

I was able to build the image, I am just trying to not having to maintain it myself. Packaging with standard deliveries is much more reliable.

@ylavoie care to give a few pointers, please? :slightly_smiling_face:

Actually looks like I can give them myself. Below there's a Docker image based on postgres:10-alpine with the extension installed and the pg_prove script available to use inside the container.

FROM postgres:10-alpine

ENV PGTAP_VERSION v0.98.0

RUN apk -U add \
    alpine-sdk \
    perl \
 && git clone https://github.com/theory/pgtap \
 && cd pgtap \
 && git checkout ${PGTAP_VERSION} \
 && make \
 && make install


FROM postgres:10-alpine

COPY --from=0 /usr/local/share/postgresql/extension/pgtap* /usr/local/share/postgresql/extension/

RUN apk -U add \
    build-base \
    perl-dev \
 && cpan TAP::Parser::SourceHandler::pgTAP \
 && apk del -r build-base

...which you can now get with docker pull 1maa/postgres:10-alpine

Closing given the rationale in https://github.com/docker-library/postgres/issues/306#issuecomment-312738926 (third-party non-core module, not something we're going to maintain as part of this image).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

greaber picture greaber  路  4Comments

rap2hpoutre picture rap2hpoutre  路  3Comments

harrybvp picture harrybvp  路  4Comments

orion110217 picture orion110217  路  3Comments

AnatoliyTishaevTR picture AnatoliyTishaevTR  路  3Comments