-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Language pack availability/strategy for <= 9.5 alpine #384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Ah, this is a hard one -- from what I can tell, the only official way to build PL/Python is by supplying postgres=# CREATE EXTENSION plpythonu;
ERROR: could not open extension control file "/usr/share/postgresql/10/extension/plpythonu.control": No such file or directory See also #340, #290, and docker-library/docs#1204. |
I was able to successfully perform FROM postgres:10-alpine
RUN set -eux; \
\
apk add --no-cache --virtual .fetch-deps \
ca-certificates \
openssl \
tar \
; \
\
wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \
echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \
mkdir -p /usr/src/postgresql; \
tar \
--extract \
--file postgresql.tar.bz2 \
--directory /usr/src/postgresql \
--strip-components 1 \
; \
rm postgresql.tar.bz2; \
\
apk add --no-cache --virtual .build-deps \
coreutils \
dpkg-dev dpkg \
gcc \
libc-dev \
libedit-dev \
make \
python-dev \
zlib-dev \
; \
\
cd /usr/src/postgresql; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
# explicitly update autoconf config.guess and config.sub so they support more arches/libcs
wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \
wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \
# configure options taken from:
# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
./configure \
--build="$gnuArch" \
--prefix=/usr/local \
--with-includes=/usr/local/include \
--with-libraries=/usr/local/lib \
--with-python \
; \
cd src/pl/plpython; \
make -j "$(nproc)"; \
make install; \
find /usr/local -iname '*plpython*' \
-exec scanelf --needed --nobanner --format '%n#p' '{}' + \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| xargs -rt apk add \
; \
apk del .fetch-deps .build-deps; \
cd /; \
rm -rf \
/usr/src/postgresql \
/usr/local/share/doc \
/usr/local/share/man \
; \
find /usr/local -name '*.a' -delete So in short, this is possible to add after the fact without recompiling all of PostgreSQL. 🤘 |
I am not really understand, if I can just mkdir such folder in container will solve this question? @tianon |
No, you will need to build the desired extensions similar to the example
I've supplied above or use Debian-based images instead and install the
appropriate packages.
|
@tianon sorry to revive this old thread but I am wanting to get plpython3 working in a docker container and I don't quite understand why I'm failing. I succeeded with I tried modifying the Dockerfile with
I guess I need to give the compiler python3 flags somehow... EDIT: I was so close: For posterity, the solution for me was to install
|
Hah, I should've checked your edit before I played with it! For reference, the place I found that (Glad you got it figured!) |
problem
language packs (plpython) aren't available in any alpine version official repos for pg <= 9.5.x
discussion
alpine doesn't ship a plpython for postgres 9.5.x/9.5.10, and im struggling to find documentation on how to load it.
The text was updated successfully, but these errors were encountered: