postgis / docker-postgis

Docker image for PostGIS
https://hub.docker.com/r/postgis/postgis/
MIT License
1.37k stars 462 forks source link

patch: docker-postgis with postgres 9.5 for Alpine #276

Closed cristianbogdan closed 2 years ago

cristianbogdan commented 2 years ago

I was able to build what would be 9.5-2.5/alpine/ It requires a build of llvm-11. Since I can't submit a pull request, here is a diff

Probably only relevant parts of thellvm-11 binaries should be kept in the image.

diff --git a/9.6-2.5/alpine/Dockerfile b/9.6-2.5/alpine/Dockerfile
index 9d6daa9..28f28e5 100644
--- a/9.6-2.5/alpine/Dockerfile
+++ b/9.6-2.5/alpine/Dockerfile
@@ -1,4 +1,4 @@
-FROM postgres:9.6-alpine3.14
+FROM postgres:9.5.25-alpine

 LABEL maintainer="PostGIS Project - https://postgis.net"

@@ -10,6 +10,26 @@ ENV POSTGIS_SHA256 24b15ee36f3af02015da0e92a18f9046ea0b4fd24896196c8e6c2aa8e4b56
 #   reason:  PostGIS 2.5.5 is not working with GEOS 3.9.*
 ENV POSTGIS2_GEOS_VERSION tags/3.8.2

+RUN wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/llvm-project-11.0.0.tar.xz && \
+  tar xvf llvm-project-11.0.0.tar.xz && \
+  apk --no-cache add --no-cache --virtual .llvm-deps\
+       autoconf \
+       automake \
+       freetype-dev \
+       g++ \
+       git \
+       gcc \
+       cmake \
+       make \
+    libxml2-dev \
+    python2 \
+    ncurses-dev && \
+    cd llvm-project-11.0.0/llvm/ && mkdir build && cd build && cmake .. \
+    -G "Unix Makefiles" -DLLVM_TARGETS_TO_BUILD="X86" \
+    -DCMAKE_BUILD_TYPE=MinSizeRel && make -j$(nproc) && make install && make -j test \
+    && cd .. && rm -rf llvm-project-11.0.0 && apk del .llvm-deps
+    
+
 RUN set -eux \
     \
     && apk add --no-cache --virtual .fetch-deps \
@@ -39,7 +59,6 @@ RUN set -eux \
         json-c-dev \
         libtool \
         libxml2-dev \
-        llvm11-dev \
         make \
         pcre-dev \
         perl \
ImreSamu commented 2 years ago

Thank you for the suggestion.

I was able to build what would be 9.5-2.5/alpine/ ... Since I can't submit a pull request, here is a diff

as I know:

Postgres 9.5 is an unsupported version of PostgreSQL and users are encouraged to update to a newer release.

if you need for testing - you can use the older postgis/postgis:9.5-2.5-alpine images


And also EOL in the upstream docker-library : https://github.com/docker-library/postgres/commit/56eb8091dc67efe65b7a5a101e80ab83a9ca70a3

The last postgres:9.5-alpine image is https://hub.docker.com/_/postgres?tab=tags&page=1&name=9.5-alpine

If you want to rebuild - you can use the last 9.5-2.5/alpine/Dockerfile (with llvm10-dev)

cristianbogdan commented 2 years ago

Thanks a lot for the info and fr your work!