I have been Googling for a while and can't seem to find an answer to this:
I am trying to build a Docker image based on the Postgresql10:10:stretch-slim image that contains several extensions: PostGIS, pgRouting (both can be pulled from APT),
sqlite3_fdw and neo4j-fdw (both pulled via pgxn).
My problem is that, even though the base image points to Postgres10.10, pgxn want to build the extensions for Postgresql-12:
---> Running in ccd8afa3b8cd
INFO: best version: sqlite_fdw 1.2.0
INFO: saving /tmp/tmpMkbHEP/sqlite_fdw-1.2.0.zip
INFO: unpacking: /tmp/tmpMkbHEP/sqlite_fdw-1.2.0.zip
INFO: building extension
Makefile:35: /usr/lib/postgresql/12/lib/pgxs/src/makefiles/pgxs.mk: No such file or directory Makefile:40: *** PostgreSQL 9.6, 10, 11 or 12 is required to compile this extension. Stop.
ERROR: command returned 2: make PG_CONFIG=/usr/bin/pg_config all
The command '/bin/sh -c pgxn install sqlite_fdw' returned a non-zero code: 1
(same result for Neo).
How do I get pgxn to use the proper version in my Docker file?
I tried updating the path to ensure that pg_config from the /usr/lib/postgresql10/bin folder was first based on this post:
And I tried setting an ENV variable pointing to the proper version of Postgres, but always get stuck at the above error....
Here is the applicable parts of the Docker file:
# vim:set ft=dockerfile:
# We base our deployment on Postgres10.10
FROM postgres:10.10
#ENV dirpath /opt/GIT_REPO/PostgresConfiguration/
#Update the path to use the proper Postgres directory
#ENV PATH=/usr/lib/postgresql/10:$PATH
# Populate the PGDATA variable from the base container
# ENV PGDATA /var/lib/pgsql/10/data
#Install dependencies: postgis25_10, pgrouting_10, multicorn (basis for FDWs)
RUN apt-get update && apt-get install -y \
build-essential\
pgxnclient\
postgresql-10-postgis-2.5 \
postgresql-10-pgrouting \
s3cmd \
libpq-dev \
build-essential \
postgresql-10-python-multicorn \
python-pip \
python3-pip \
libsqlite3-dev \
git \
&& rm -rf /var/lib/apt/lists/*
RUN pip install psycopg2-binary
RUN pip3 install psycopg2-binary
## Install the SQLite FDW
# Update the local git repo for the sqlite FDW extension
# RUN cd ./sqlite_fdw
# RUN ["make", "USE_PGXS=1"]
# RUN ["make install","USE_PGXS=1"]
#Remove the source tree
# RUN cd ..
# RUN ["rm", "-R", "./sqlite_fdw"]
ENV PG_CONFIG=/usr/lib/postgresql/10/bin/pg_config
ENV USE_PGXS=1
RUN pgxn install sqlite_fdw
## Install the Neo4J FDW packages
## We have multicorn, install from source
RUN pgxn install neo4j-fdw
I would appreciate any help on this....seems like it is probably a fairly simple solution....
Thanks,
Eric