File tree Expand file tree Collapse file tree 7 files changed +85
-3
lines changed
Expand file tree Collapse file tree 7 files changed +85
-3
lines changed Original file line number Diff line number Diff line change 3030 filters : |
3131 pgvector:
3232 - 'pgvector/**'
33+ postgis:
34+ - 'postgis/**'
3335
3436 # Compute a matrix containing the list of all extensions that have been modified
3537 - name : Compute matrix
Original file line number Diff line number Diff line change 4747 steps :
4848 - name : Checkout repository
4949 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
50- with :
51- persist-credentials : false
5250
5351 - name : Fetch latest extension versions
5452 id : fetch_versions
@@ -61,11 +59,17 @@ jobs:
6159 readarray -t POSTGRES_MAJORS < <(sed -n '/variable "pgVersions"/,/]/ { s/^[[:space:]]*"\([^"]*\)".*/\1/p }' docker-bake.hcl)
6260 # Get the extension name
6361 EXT_NAME=$(jq -r '.metadata.name' "$EXTENSION_NAME/metadata.json")
62+ # Get the extension major version
63+ EXT_MAJOR=$(jq -r '.metadata.major_version' "$EXTENSION_NAME/metadata.json")
6464
6565 for DISTRO in "${DISTROS[@]}"; do
6666 for MAJOR in "${POSTGRES_MAJORS[@]}"; do
67+ PKG="postgresql-${MAJOR}-${EXT_NAME}"
68+ if [[ -n "$EXT_MAJOR" ]] && [[ "$EXT_MAJOR" != "null" ]]; then
69+ PKG="postgresql-${MAJOR}-${EXT_NAME}-${EXT_MAJOR}"
70+ fi
6771 VERSION=$(curl -s "https://apt.postgresql.org/pub/repos/apt/dists/$DISTRO-pgdg/main/binary-amd64/Packages" \
68- | awk -v pkg="postgresql-${MAJOR}-${EXT_NAME }" '
72+ | awk -v pkg="${PKG }" '
6973 $1 == "Package:" && $2 == pkg {show=1; next}
7074 show && $1 == "Version:" {print $2; show=0}
7175 ' \
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ in CloudNativePG.
2121## Supported Extensions
2222
2323- [ pgvector] ( pgvector ) - Open-source vector similarity search for PostgreSQL
24+ - [ pgvector] ( postgis ) - Open-source geospatial database extension for PostgreSQL
2425
2526---
2627
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ target "default" {
5656 args = {
5757 PG_MAJOR = " ${ pgVersion } "
5858 EXT_VERSION = " ${ getExtensionPackage (distro, pgVersion)} "
59+ EXT_MAJOR = " ${ metadata . major_version } "
5960 BASE = " ${ getBaseImage (distro, pgVersion)} "
6061 }
6162
Original file line number Diff line number Diff line change 1+ ARG BASE=ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie
2+ FROM $BASE AS builder
3+
4+ ARG PG_MAJOR
5+ ARG EXT_VERSION
6+ ARG EXT_MAJOR
7+
8+ USER 0
9+
10+ RUN set -eux && \
11+ # Initial system libraries
12+ ldconfig -p | awk '{print $NF}' | grep '^/' | sort | uniq > /tmp/base-image-libs.out && \
13+ # Install PostGIS
14+ apt-get update && \
15+ apt-get install -y --no-install-recommends "postgresql-${PG_MAJOR}-postgis-${EXT_MAJOR}=${EXT_VERSION}"
16+
17+ # Gather PostGIS system libraries and their licenses
18+ RUN mkdir -p /system /licenses && \
19+ # Get libraries
20+ ldd /usr/lib/postgresql/${PG_MAJOR}/lib/address_standardizer*.so \
21+ /usr/lib/postgresql/${PG_MAJOR}/lib/postgis*.so \
22+ | awk '{print $3}' | grep '^/' | sort | uniq > /tmp/all-deps.out && \
23+ comm -13 /tmp/base-image-libs.out /tmp/all-deps.out > /tmp/libraries.out && \
24+ for lib in $(cat /tmp/libraries.out); do cp -a "${lib%.so*}.so" * /system; done && \
25+ # Get licenses
26+ for lib in $(find /system -maxdepth 1 -type f -name '*.so*' ); do \
27+ pkg=$(dpkg -S "$(basename " $lib")" | awk -F: '{print $1}' ); \
28+ [ -z "$pkg" ] && continue; \
29+ mkdir -p "/licenses/$pkg" && cp -a /usr/share/doc/"$pkg" /* "/licenses/$pkg/" ; \
30+ done
31+
32+
33+ FROM scratch
34+ ARG PG_MAJOR
35+ ARG EXT_MAJOR
36+
37+ # Licenses
38+ COPY --from=builder /licenses /licenses/
39+ COPY --from=builder /usr/share/doc/postgresql-${PG_MAJOR}-postgis-${EXT_MAJOR}/copyright /licenses/postgresql-${PG_MAJOR}-postgis-${EXT_MAJOR}/
40+
41+ # Libraries
42+ COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/address_standardizer* /usr/lib/postgresql/${PG_MAJOR}/lib/postgis* /lib/
43+ COPY --from=builder /usr/lib/postgresql/18/lib/bitcode/ /lib/bitcode/
44+
45+ # Share
46+ COPY --from=builder /usr/share/postgresql/${PG_MAJOR}/extension/address_standardizer* /usr/share/postgresql/${PG_MAJOR}/extension/postgis* /share/extension/
47+ COPY --from=builder /usr/share/postgresql/${PG_MAJOR}/contrib/postgis* /share/contrib/
48+
49+ # System libs
50+ COPY --from=builder /system /system/
51+
52+ USER 65532:65532
Original file line number Diff line number Diff line change 1+ # PostGIS
2+
3+ TODO
Original file line number Diff line number Diff line change 1+ {
2+ "metadata" : {
3+ "name" : " postgis" ,
4+ "sql_name" : " postgis" ,
5+ "shared_preload_libraries" : [],
6+ "extension_control_path" : [],
7+ "dynamic_library_path" : [],
8+ "ld_library_path" : [" /system" ],
9+ "major_version" : " 3" ,
10+ "versions" : {
11+ "bookworm" : {
12+ "18" : " 3.6.0+dfsg-3.pgdg12+1"
13+ },
14+ "trixie" : {
15+ "18" : " 3.6.0+dfsg-3.pgdg13+1"
16+ }
17+ }
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments