Обсуждение: Dockerfile for testing with Perl 5.8.8

Поиск
Список
Период
Сортировка

Dockerfile for testing with Perl 5.8.8

От
Craig Ringer
Дата:
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
Вложения

Re: Dockerfile for testing with Perl 5.8.8

От
Craig Ringer
Дата:
On 3 March 2016 at 11:06, Craig Ringer <craig@2ndquadrant.com> wrote:
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.


That one didn't include a new enough flex or bison, so it couldn't rebuild a fully clean tree that hadn't been built on the host first.

Fixed in the attached along with some other cleanups.

I'm not proposing to commit this of course, though I'll probably stash it on github and link to it in the wiki.  I just think it'll be a useful tool for those of us doing TAP framework stuff - and anyone writing tests, since those too will have to work with $ancientperl. (Yes, I stand by "ancient" - CentOS 5, Debian Etch? Ancient.)

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
Вложения

Re: Dockerfile for testing with Perl 5.8.8

От
Craig Ringer
Дата:

On 3 March 2016 at 13:08, Craig Ringer <craig@2ndquadrant.com> wrote:
On 3 March 2016 at 11:06, Craig Ringer <craig@2ndquadrant.com> wrote:
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.


That one didn't include a new enough flex or bison, so it couldn't rebuild a fully clean tree that hadn't been built on the host first.

Fixed in the attached along with some other cleanups.
 


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