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: Dockerfile
Description: Binary data

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to