Dockerfile for testing with Perl 5.8.8

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Dockerfile for testing with Perl 5.8.8
Date: 2016-03-03 03:06:56
Message-ID: CAMsr+YGR6pU-gUyp-FT98XwXAsc9n6j-awZAqxvW_+P3RTC7cg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all

I've prepared a Dockerfile that produces a canned Perl 5.8.8 environment
based on CentOS 5 on any host with Docker. It has ccache installed and
enabled, git installed, IPC::Run installed, all the mess required to make
CPAN work sensibly done, etc.

Once you build the container once you can quickly re-use it to run test
builds. You can map a postgres source tree, working tree and ccache
directory from the host to make them persistent.

Understand that this container runs code fetched directly off the 'net as
root, albeit root within a container, during setup. It avoids running all
the perl/cpan stuff as root though, switching to a normal user as soon as
it's installed the required RPMs from centos repos and rpmforge, so it's
not just curl'ing random scripts into bash/perl as root.

To build the container:

mkdir pgtaptest
cp /path/to/Dockerfile pgtaptest
cd pgtaptest
docker build -t pgtaptest .

To run a shell in the container environment:

alias pgtaptest="docker run -i -t \
-v /path/to/my/postgres/tree:/postgres \
-v /path/to/builddir:/pgbuild \
-v /path/to/ccache:/ccache \
pgtaptest'

pgtaptest

Once in the working environment's shell, /postgres is the mapped source
tree, /pgbuild is the mapped build tree (or an empty dir, if you didn't map
it), and /ccache is the mapped ccache or - again - an empty tree if you
didn't map it. Unmapped volumes get discarded when the container instance
exits.

There's an alias preconfigured, recovery-check, that configures and makes
postgres and runs the recovery tests. To run it directly from the host,
assuming you created the alias above, just:

pgtaptest recovery-check

I've accepted some ugly inline script generation in the dockerfile to avoid
needing separate files, so it's self-contained.

Happy Perl 5.8'ing!

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
Dockerfile application/octet-stream 2.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2016-03-03 03:32:26 Re: The plan for FDW-based sharding
Previous Message Peter Eisentraut 2016-03-03 02:48:16 Re: GinPageIs* don't actually return a boolean