Add pgrouting 3.8 with pg13-17, postgis3.5#69
Conversation
WalkthroughThis update introduces new Docker build and deployment configurations for pgRouting version 3.8.0, supporting PostgreSQL versions 13 through 17, each paired with PostGIS 3.5. For each supported version, the update adds a main Dockerfile to build pgRouting from source, a README, a docker-compose.yml for service orchestration, an optional extra Dockerfile for osm2pgrouting support, and a version.txt file. The root README.md is updated to document these new versions and adjust badges. All Dockerfiles follow a consistent pattern of installing dependencies, building from source, and cleaning up to minimize image size. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Docker Compose
participant pgRouting Container
participant PostGIS/PostgreSQL
participant Volume
User->>Docker Compose: docker-compose up
Docker Compose->>pgRouting Container: Start container (pgRouting + PostGIS)
pgRouting Container->>PostGIS/PostgreSQL: Initialize/PostgreSQL startup
pgRouting Container->>Volume: Mount /var/lib/postgresql/data
User->>pgRouting Container: Connect via port 5432
Note right of pgRouting Container: pgRouting 3.8.0 available
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Well, I also added pgrouting 3.8 with pg13-15, postgis3.5.
|
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (19)
17-3.5-3.8/docker-compose.yml (1)
1-12: (Duplication) See suggestions on metadata and isolation in14-3.5-3.8/docker-compose.yml.13-3.5-3.8/docker-compose.yml (1)
1-12: (Duplication) See suggestions on metadata and isolation in14-3.5-3.8/docker-compose.yml.16-3.5-3.8/docker-compose.yml (1)
1-12: (Duplication) See suggestions on metadata and isolation in14-3.5-3.8/docker-compose.yml.17-3.5-3.8/extra/Dockerfile (4)
5-18: See previous feedback on combining and optimizingaptsteps.
19-21: See previous feedback on adding checksum verification.
28-35: See previous feedback on targeted cleanup instead ofrm -rf ./*.
36-45: See previous feedback on usingapt-get --no-install-recommendsand merging purge steps.13-3.5-3.8/Dockerfile (1)
8-25: See feedback on consolidatingapt-getcommands and using--no-install-recommends.17-3.5-3.8/Dockerfile (4)
1-4: VerifyPG_MAJOR& standardize labels
Same as in the 16-3.5 Dockerfile: confirmPG_MAJORis set, and consider adding VCS/maintainer labels for version traceability.
5-7: Promote version flexibility with build args
Mirroring the 16-3.5 suggestion: useARGforPGROUTING_VERSIONandPGROUTING_SHA256to decouple build-time parameters from runtime environment.
8-50: Merge apt operations into a single RUN
As above, consolidateapt-get update, installations, source fetch, build, and cleanup into one optimizedRUNto reduce layers and leverage--no-install-recommends.
51-52: Explain PostGIS init script deletion
Also applies here: ensure the removal of10_postgis.shis documented to avoid confusion for users expecting PostGIS bootstrap.14-3.5-3.8/extra/Dockerfile (4)
1-4: Apply same version-arg refactor as in 13-3.5-3.8/extra Dockerfile
Refer to the suggestion to useARGforOSM2PGROUTING_VERSIONand conditionally export it.
5-18: Consolidate apt-get installation
See the combinedapt-getpattern recommended in the 13-3.5-3.8 extra Dockerfile for minimal layers and--no-install-recommends.
19-34: Simplify tar extraction & build steps
The approach suggested for the 13-3.5-3.8 extra Dockerfile applies here as well: usetar -xzf … --strip-components=1and consider multi-stage for build deps.
35-46: Merge cleanup steps
Align with the same cleanup consolidation advice given for the 13-3.5-3.8 extra Dockerfile.14-3.5-3.8/Dockerfile (3)
1-4: Confirm base image variables and add rich labels
Same as for the 16-3.5/17-3.5 Dockerfiles: ensurePG_MAJORis set and enrich the image with standardized VCS/maintainer labels.
5-7: Switch pgRouting version & checksum to build args
Apply theARG-based refactor forPGROUTING_VERSIONandSHA256as suggested in the other main Dockerfiles for consistency.
51-52: Document init script removal
Ensure users understand why10_postgis.shis removed; refer to the note provided in the other main Dockerfiles.
🧹 Nitpick comments (22)
17-3.5-3.8/README.md (1)
1-4: Add usage instructions and pin base image tags.
The README introduces the pgRouting 3.8.0 image but omits concrete usage examples (e.g., how todocker pullordocker build). Also, consider pinning the PostGIS base image to a specific tag (e.g.,postgis/postgis:17-3.5) for reproducible builds instead of the genericpostgis/postgislink.14-3.5-3.8/README.md (1)
1-4: Pin the PostGIS base image and include build instructions.
To improve reproducibility, specify the exact base image tag (e.g.,postgis/postgis:14-3.5). Adding a brief build or pull example—such as adocker pull pgrouting/pgrouting:3.8-pg14-postgis3.5command—would help users get started quickly.16-3.5-3.8/README.md (1)
1-4: Reference theextrabuild for osm2pgrouting support.
This directory includes anextra/Dockerfilefor building osm2pgrouting. It would be helpful to mention in the README how users can use this subdirectory to build the osm2pgrouting variant or provide a link toextra/Dockerfile.15-3.5-3.8/README.md (1)
1-4: Provide reproducible base image and quickstart section.
Consider updating the PostGIS link to a pinned tag (e.g.,postgis/postgis:15-3.5) and adding a Quickstart section with commands for pulling and running the container. This will lower the barrier for new users.13-3.5-3.8/README.md (1)
1-4: Enhance README with specific tags and usage.
The README is concise but would benefit from explicit pull/build commands and pinning the base image topostgis/postgis:13-3.5. Consider expanding with minimal usage snippets and a note on where to find the corresponding Dockerfiles in this directory.14-3.5-3.8/docker-compose.yml (1)
1-12: Enhance Docker Compose metadata and isolation.To make this Compose file more robust and avoid resource collisions when running multiple versions in parallel, consider:
- Adding an explicit format version at the top, e.g.
version: "3.8"- Scoping the volume name to this version (e.g.
db-data-14-3.5-3.8.0) so it doesn’t clash with other setups.- Optionally adding:
for clearer container identity and automatic recovery.restart: unless-stopped container_name: pgrouting-14-3.5-3.8.015-3.5-3.8/docker-compose.yml (2)
4-5: Consider making host port configurable.
Exposing"5432:5432"by default is fine for local development, but you may want to allow overriding the host port (e.g., via.envor variable interpolation) to avoid collisions in multi-service setups.
8-9: Avoid hardcoding the database password in source.
DefiningPOSTGRES_PASSWORD=postgresdirectly in the compose file poses a security risk if this is used beyond local testing. Consider loading this from an environment variable or Docker secret instead.15-3.5-3.8/extra/Dockerfile (3)
5-18: Combine and optimizeapt installsteps.
You currently run two separateapt install -ycommands. To reduce image layers and ensure non-interactive installs, merge them into a singleapt-get install -y --no-install-recommendsinvocation.
28-35: Scope of source cleanup is too broad.
Runningrm -rf ./*in/usr/local/srcmay remove unintended files. Instead, target only the extracted directory and archive (e.g.,rm -rf osm2pgrouting-${OSM2PGROUTING_VERSION}*).
36-45: Useapt-getwith--no-install-recommendsand combine purge steps.
For consistency and smaller images, switch fromapttoapt-get, merge purge and autoremove flags, and collapse into fewer RUN layers.15-3.5-3.8/Dockerfile (1)
8-17: Optimize package installation.
Combine runtime and build dependencies into a singleapt-get update && apt-get install -y --no-install-recommendsstep to reduce layers, and preferapt-getoveraptin Dockerfiles.16-3.5-3.8/Dockerfile (2)
5-7: Use build-time args for version and checksum
Exposing these as runtimeENVincreases image metadata. Switch toARGto allow overrides and only exportENVif truly needed at runtime:- ENV PGROUTING_VERSION=3.8.0 - ENV PGROUTING_SHA256=b8a5f0472934fdf7cda3fb4754d01945378d920cdaddc01f378617ddbb9c447f + ARG PGROUTING_VERSION=3.8.0 + ARG PGROUTING_SHA256=b8a5f0472934fdf7cda3fb4754d01945378d920cdaddc01f378617ddbb9c447f + ENV PGROUTING_VERSION=$PGROUTING_VERSION
8-50: Consolidate and hardenaptsteps in one layer
Multipleapt update/install/purgecalls inflate layers and cache. Adopt a singleRUNusingapt-get,--no-install-recommends,DEBIAN_FRONTEND=noninteractive, and cleanup in place. Example diff:RUN set -ex \ - && apt update \ - && apt install -y \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ libboost-atomic1.74.0 \ libboost-chrono1.74.0 \ libboost-graph1.74.0 \ libboost-date-time1.74.0 \ libboost-program-options1.74.0 \ libboost-system1.74.0 \ libboost-thread1.74.0 \ build-essential \ cmake \ wget \ libboost-graph-dev \ libpq-dev \ postgresql-server-dev-${PG_MAJOR} \ - && apt install -y \ - build-essential \ - cmake \ - wget \ - libboost-graph-dev \ - libpq-dev \ - postgresql-server-dev-${PG_MAJOR} \ + && wget -O pgrouting.tar.gz "https://github.com/pgRouting/pgrouting/archive/v${PGROUTING_VERSION}.tar.gz" \ + && echo "$PGROUTING_SHA256 *pgrouting.tar.gz" | sha256sum -c - \ + && mkdir -p /usr/src/pgrouting \ + && tar -xzf pgrouting.tar.gz --strip-components=1 -C /usr/src/pgrouting \ + && rm pgrouting.tar.gz \ + && cd /usr/src/pgrouting && mkdir build && cd build && cmake .. && make && make install \ + && cd / && rm -rf /usr/src/pgrouting \ + && apt-mark manual postgresql-${PG_MAJOR} \ + && DEBIAN_FRONTEND=noninteractive apt-get purge -y --auto-remove \ build-essential \ cmake \ wget \ libpq-dev \ libboost-graph-dev \ postgresql-server-dev-${PG_MAJOR} \ + && rm -rf /var/lib/apt/lists/*This reduces image size and speeds up builds.
13-3.5-3.8/extra/Dockerfile (4)
1-4: Use build-time args for Osm2pgrouting version
SwitchENV OSM2PGROUTING_VERSIONto anARGto allow version overrides at build time, then conditionally export it if needed at runtime.
5-18: Combineaptsteps and pin installs
Unifyapt updateand bothapt installcalls into oneDEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends …step, followed by a single cleanup of/var/lib/apt/lists/*.
19-34: Streamline source extraction & build
Usetar -xzfwith--strip-components=1to extract directly into a dedicated build folder, then build in one go. Optionally move heavy build deps to a multi-stage build to shrink the final image.
35-46: Merge purge and cleanup into same layer
Current separateapt purge,apt autoremove, andrm -rfcreate extra layers. Combine these into the singleRUNfor a leaner final image.14-3.5-3.8/Dockerfile (1)
8-50: Single-layer apt workflow
Consolidate update/install/build/purge in oneRUNwithapt-get,--no-install-recommends, and cleanup, mirroring the pattern in the 16-3.5 Dockerfile.16-3.5-3.8/extra/Dockerfile (3)
18-33: LeverageWORKDIRand addldconfigpost-install.
Instead of chainingcd, set a working directory to simplify path management:WORKDIR /usr/local/src RUN wget https://github.com/pgRouting/osm2pgrouting/archive/v${OSM2PGROUTING_VERSION}.tar.gz \ && tar xvf v${OSM2PGROUTING_VERSION}.tar.gz \ && mkdir -p osm2pgrouting-${OSM2PGROUTING_VERSION}/build \ && cd osm2pgrouting-${OSM2PGROUTING_VERSION}/build \ && cmake .. \ && make \ && make install \ && mkdir -p ../tools/osmium/build \ && cd ../tools/osmium/build \ && cmake .. \ && make \ && make install \ && ldconfigThis improves readability and ensures any newly installed shared libraries are registered.
34-35: Target the cleanup of the source directory.
Rather thanrm -rf ./*, narrow it down to just the extracted source:- && rm -rf ./* \ + && rm -rf osm2pgrouting-${OSM2PGROUTING_VERSION} \This guards against unintended deletions if other artifacts are added later.
36-45: Streamline the purge and cleanup steps.
Consider usingapt-get purge --auto-remove, followed byapt-get clean, to remove build-time packages and caches consistently:- && apt purge -y --autoremove \ - build-essential \ - cmake \ - wget \ - libboost-program-options-dev \ - libexpat-dev \ - libosmium2-dev \ - libpqxx-dev \ - zlib1g-dev \ - && apt autoremove -y \ - && rm -rf /var/lib/apt/lists/* + && apt-get purge -y --auto-remove \ + build-essential \ + cmake \ + wget \ + libboost-program-options-dev \ + libexpat-dev \ + libosmium2-dev \ + libpqxx-dev \ + zlib1g-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/*This aligns with Debian best practices and avoids residual caches.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (26)
13-3.5-3.8/Dockerfile(1 hunks)13-3.5-3.8/README.md(1 hunks)13-3.5-3.8/docker-compose.yml(1 hunks)13-3.5-3.8/extra/Dockerfile(1 hunks)13-3.5-3.8/version.txt(1 hunks)14-3.5-3.8/Dockerfile(1 hunks)14-3.5-3.8/README.md(1 hunks)14-3.5-3.8/docker-compose.yml(1 hunks)14-3.5-3.8/extra/Dockerfile(1 hunks)14-3.5-3.8/version.txt(1 hunks)15-3.5-3.8/Dockerfile(1 hunks)15-3.5-3.8/README.md(1 hunks)15-3.5-3.8/docker-compose.yml(1 hunks)15-3.5-3.8/extra/Dockerfile(1 hunks)15-3.5-3.8/version.txt(1 hunks)16-3.5-3.8/Dockerfile(1 hunks)16-3.5-3.8/README.md(1 hunks)16-3.5-3.8/docker-compose.yml(1 hunks)16-3.5-3.8/extra/Dockerfile(1 hunks)16-3.5-3.8/version.txt(1 hunks)17-3.5-3.8/Dockerfile(1 hunks)17-3.5-3.8/README.md(1 hunks)17-3.5-3.8/docker-compose.yml(1 hunks)17-3.5-3.8/extra/Dockerfile(1 hunks)17-3.5-3.8/version.txt(1 hunks)README.md(2 hunks)
🔇 Additional comments (23)
13-3.5-3.8/version.txt (1)
1-1: Version string matches directory and release.
The content13-3.5-3.8.0correctly reflects Postgres 13, PostGIS 3.5, and pgRouting 3.8.0.14-3.5-3.8/version.txt (1)
1-1: Version string matches directory and release.
The content14-3.5-3.8.0correctly reflects Postgres 14, PostGIS 3.5, and pgRouting 3.8.0.15-3.5-3.8/version.txt (1)
1-1: Version string matches directory and release.
The content15-3.5-3.8.0correctly reflects Postgres 15, PostGIS 3.5, and pgRouting 3.8.0.16-3.5-3.8/version.txt (1)
1-1: Version string matches directory and release.
The content16-3.5-3.8.0correctly reflects Postgres 16, PostGIS 3.5, and pgRouting 3.8.0.17-3.5-3.8/version.txt (1)
1-1: Version string matches directory and release.
The content17-3.5-3.8.0correctly reflects Postgres 17, PostGIS 3.5, and pgRouting 3.8.0.README.md (1)
3-4: Verify badge configuration and branch name.The GitHub Actions badge references
branch=masterand a workflow file namedmain.yml. Please confirm:
- That your default branch is really
master(notmain).- That the workflow filename is indeed
main.yml.
If either is different, update the badge URL to point to the correct branch and file.15-3.5-3.8/docker-compose.yml (2)
1-3: Service definition and image tag look correct.
Thepgroutingservice is properly configured to usepgrouting/pgrouting:15-3.5-3.8.0, matching the intended pgRouting/PostGIS version pairing.
6-7: Volume configuration is properly declared.
Thedb-datavolume is both mounted under/var/lib/postgresql/dataand declared at the bottom—this ensures persistent storage across container restarts.Also applies to: 10-11
15-3.5-3.8/extra/Dockerfile (1)
1-4: Base image and version pinning look good.
UsingFROM pgrouting/pgrouting:15-3.5-3.8.0and settingOSM2PGROUTING_VERSION=2.3.8ensures reproducible builds.17-3.5-3.8/extra/Dockerfile (1)
1-4: Base image and environment are correct.
SelectingFROM pgrouting/pgrouting:17-3.5-3.8.0and settingOSM2PGROUTING_VERSION=2.3.8aligns with the other version directories.15-3.5-3.8/Dockerfile (5)
1-7: Metadata and version pins are properly set.
LABEL maintainer,PGROUTING_VERSION, andPGROUTING_SHA256ensure clear ownership and build reproducibility.
18-27: Checksum verification is implemented correctly.
You validatepgrouting.tar.gzagainst the SHA256 sum before extracting—this is best practice for supply-chain security.
28-42: Build and install steps are clear and correct.
CMake build invocation, installation, and cleanup of/usr/src/pgroutingfollow the expected pattern.
43-51: Cleanup of build dependencies and apt lists is thorough.
Usingapt purge --autoremovefollowed by removal of/var/lib/apt/listsyields a minimal final image.
51-52: Removal of default PostGIS init script is intentional.
Stripping out10_postgis.shprevents duplicate PostGIS installation during container startup.13-3.5-3.8/Dockerfile (5)
1-7: Base image, labels, and versioning are correctly applied.
FROM postgis/postgis:13-3.5along withPGROUTING_VERSIONand checksum ENV vars match the pattern established for other PostGIS versions.
26-33: Archive extraction and directory structuring are correct.
Thetar --strip-components 1usage ensures sources land under/usr/src/pgroutingcleanly.
34-42: Build and installation steps are consistent.
CMake,make, and post-install cleanup follow the same reliable pattern as other version Dockerfiles.
43-51: Build dependency purge and apt list cleanup are implemented properly.
Usingapt purge -y --autoremovefollowed by removing/var/lib/apt/listsensures a lean image.
52-52: PostGIS init script removal is applied.
Stripping10_postgis.shaligns with the approach in other Dockerfiles.16-3.5-3.8/Dockerfile (2)
1-4: VerifyPG_MAJORavailability and enrich labels
The basepostgis/postgis:16-3.5image should definePG_MAJOR. Please confirm it’s exported as expected. Consider adding standardized metadata labels (e.g., VCS URL, image version) for better traceability.
51-52: Document removal of default PostGIS init script
Deleting/docker-entrypoint-initdb.d/10_postgis.shprevents automatic PostGIS setup. Ensure this is intentional and won’t break downstream workflows—consider a comment explaining the rationale.16-3.5-3.8/extra/Dockerfile (1)
1-2:Details
❓ Verification inconclusive
Verify the base image tag on Docker Hub.
Please confirm thatpgrouting/pgrouting:16-3.5-3.8.0is published and matches the naming scheme used in sibling directories (e.g.,13-3.5-3.8.0,14-3.5-3.8.0, etc.).
🏁 Script executed:
#!/bin/bash # Check for the existence of the tag on Docker Hub curl -s "https://registry.hub.docker.com/v2/repositories/pgrouting/pgrouting/tags?page_size=100" \ | jq '.results[] | select(.name=="16-3.5-3.8.0")'Length of output: 148
Please verify the
pgrouting/pgrouting:16-3.5-3.8.0tag on Docker Hub
- File:
16-3.5-3.8/extra/Dockerfile(lines 1–2)- Snippet:
FROM pgrouting/pgrouting:16-3.5-3.8.0I queried the Docker Hub tags API (first 100 results) and didn’t see
16-3.5-3.8.0. Please confirm that this tag is published and follows the same naming scheme as13-3.5-3.8.0,14-3.5-3.8.0, etc. You may need to increasepage_sizein your API request or check the Docker Hub UI directly.
|
@iosefa Okay, thanks for confirmation! |
Changes proposed in this pull request:
I feel adding pgrouting 3.8 to all combination and removing pgrouting 3.6 may be a bit early, so I just added pgrouting 3.8 to pg13-17.
@pgRouting/admins
Summary by CodeRabbit
New Features
Documentation