'Postgres: Install a specific version of plv8

I'm installing plv8 in docker:

FROM postgres:13 AS build

ENV PLV8_VERSION=v3.0.0

RUN apt-get update && apt-get upgrade \
    && apt-get install -y git curl glib2.0 libc++-dev python python3-pip 
       libv8-dev postgresql-server-dev-$PG_MAJOR libncurses5

RUN pip install pgxnclient
RUN pgxn install plv8

This still seems to install the 2.3.11 version of plv8 though, which is incompatible with Postgres 13.

Is there any way I can specify the version that pgxn installs? Or any other way I can install a Postgres 13 version of plv8?



Solution 1:[1]

You can use our finished docker-images with postgres and plv8. It's free, images for Postgres 13 and 14 based on Debian and Alpine are available.

docker pull sibedge/postgres-plv8

Default uses Alpine and last Postgres version. All available tags here

Pay attention, that BigInt is not serializable in v8 and by default in plv8 v3.0.0 and higher BigInt numbers are converted into string(!). But if you need BigInt as numbers support, use this image with Postgres and specific version of plv8:

docker pull sibedge/postgres-plv8-bigint

OR you can use our binaries with these Dockerfiles and fast build compact images with postgres and plv8 yourself:

Postgres 14.2, plv8 v3.0.0, Alpine based. size of image is 235MB.

Postgres 13.6, plv8 v3.0.0, Alpine based. size of image is 231MB.

Postgres 13.4, plv8 v2.13.15, Debian based. size of image is 351MB.

Postgres 13.6, plv8 v3.0.0, Debian based. size of image is 427MB.

$ git clone https://github.com/sibedge-llc/plv8-build.git
$ cd plv8-build/docker
$ docker build -t pg14-plv8-3
$ docker run -it -d --name pg14-plv8-3 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432/tcp pg14-plv8-3

You can use it right now.

Solution 2:[2]

It looks like the latest versions of plv8 are not yet published on pgxn network yet. The last published version is 2.3.11 and that is what you see here.

To install the latest version of plv8 you can update your Dockerfile to build plv8 from source by following the build instructions. A good starting point would be to refer to the docker image clkao/postgres-plv8 which was built with postgres:10 base image.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Akhil Bojedla