@@ -3,7 +3,7 @@ FROM $BASE AS builder
33
44ARG PG_MAJOR
55ARG EXT_VERSION
6- ARG EXT_MAJOR
6+ ARG POSTGIS_MAJOR
77ARG PG_ROUTING_VERSION
88
99USER 0
@@ -14,7 +14,7 @@ RUN set -eux && \
1414 # Install PostGIS
1515 apt-get update && \
1616 apt-get install -y --no-install-recommends \
17- "postgresql-${PG_MAJOR}-postgis-${EXT_MAJOR }=${EXT_VERSION}" \
17+ "postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR }=${EXT_VERSION}" \
1818 "postgresql-${PG_MAJOR}-pgrouting=${PG_ROUTING_VERSION}"
1919
2020# Gather PostGIS system libraries and their licenses
@@ -44,27 +44,38 @@ RUN mkdir -p /system /licenses && \
4444 # Get licenses
4545 for lib in $(find /system -maxdepth 1 -type f -name '*.so*' ); do \
4646 # Get the name of the pkg that installed the library
47- pkg=$(dpkg -S "$(basename " $lib")" | awk -F: '/:/{print $1; exit}' ); \
47+ pkg=$(dpkg -S "$(basename " $lib")" | grep -v "diversion by" | awk -F: '/:/{print $1; exit}' ); \
48+ echo "$lib: $pkg" ; \
4849 [ -z "$pkg" ] && continue; \
4950 mkdir -p "/licenses/$pkg" && cp -a "/usr/share/doc/$pkg/copyright" "/licenses/$pkg/copyright" ; \
5051 done
5152
5253
5354FROM scratch
5455ARG PG_MAJOR
55- ARG EXT_MAJOR
56+ ARG POSTGIS_MAJOR
5657
5758# Licenses
5859COPY --from=builder /licenses /licenses/
59- COPY --from=builder /usr/share/doc/postgresql-${PG_MAJOR}-postgis-${EXT_MAJOR }/copyright /licenses/postgresql-${PG_MAJOR}-postgis-${EXT_MAJOR }/
60+ COPY --from=builder /usr/share/doc/postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR }/copyright /licenses/postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR }/
6061COPY --from=builder /usr/share/doc/postgresql-${PG_MAJOR}-pgrouting/copyright /licenses/postgresql-${PG_MAJOR}-pgrouting/
6162
6263# Libraries
63- COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/address_standardizer* /usr/lib/postgresql/${PG_MAJOR}/lib/postgis* /usr/lib/postgresql/${PG_MAJOR}/lib/libpgrouting* /lib/
64+ COPY --from=builder \
65+ /usr/lib/postgresql/${PG_MAJOR}/lib/address_standardizer* \
66+ /usr/lib/postgresql/${PG_MAJOR}/lib/postgis* \
67+ /usr/lib/postgresql/${PG_MAJOR}/lib/libpgrouting* \
68+ /lib/
69+
6470COPY --from=builder /usr/lib/postgresql/18/lib/bitcode/ /lib/bitcode/
6571
6672# Share
67- COPY --from=builder /usr/share/postgresql/${PG_MAJOR}/extension/address_standardizer* /usr/share/postgresql/${PG_MAJOR}/extension/postgis* /share/extension/
73+ COPY --from=builder \
74+ /usr/share/postgresql/${PG_MAJOR}/extension/address_standardizer* \
75+ /usr/share/postgresql/${PG_MAJOR}/extension/postgis* \
76+ /usr/share/postgresql/${PG_MAJOR}/extension/pgrouting* \
77+ /share/extension/
78+
6879COPY --from=builder /usr/share/postgresql/${PG_MAJOR}/contrib/postgis* /share/contrib/
6980
7081# System libs
0 commit comments