docker pull atcr.io/rtw.run/graphhopper-builder:latest
graphhopper-builder
One-shot job that builds a fresh GraphHopper graph-cache for rtw.run, an adventure motorcycle trip planning app.
What is GraphHopper?
GraphHopper is a fast, memory-efficient, open-source routing engine written in Java that calculates routes from OpenStreetMap data. Before it can serve routes, the raw OSM data must be imported into a preprocessed graph-cache — see https://www.graphhopper.com/ for the project homepage and documentation.
This image is that import step, packaged as a container.
What this image does
Downloads Geofabrik OSM region extracts, merges them with osmium, imports a fresh graph-cache with GraphHopper, packs it as graph-cache.tar.zst (+ .md5 sidecar) and optionally uploads it to R2 for the graphhopper server to download. Run ad-hoc (e.g. monthly for fresh OSM data), not as a long-running service.
Sizing for a full 6-region build (asia, australia-oceania, central-america, europe, north-america, south-america; ~71.5GB download):
- Disk: ~150GB scratch for PBFs + merged, then ~100GB graph — provision 400GB
- RAM: works on 64–96GB with the default MMAP_STORE and
-Xmx48g
Running the container
Multiarch image (amd64 + arm64): atcr.io/rtw.run/graphhopper-builder:latest
Same-host build, no upload (graph stays on the volume for the server):
mkdir -p /srv/rtw/graphhopper /srv/rtw/graphhopper-build
podman run --rm --name graphhopper-builder --userns=keep-id \
-v /srv/rtw/graphhopper-build:/data/osm \
-v /srv/rtw/graphhopper:/data/graphhopper \
atcr.io/rtw.run/graphhopper-builder:latest
With R2 upload (needs an rclone r2 remote configured):
-e GRAPH_CACHE_URL=r2://rtw-data/graphhopper/graph-cache.tar.zst
For a small test build: -e REGIONS=australia-oceania.
| Var | Default | Meaning |
|---|---|---|
REGIONS |
6 continents minus Africa | Geofabrik regions to download. Sub-regions work: REGIONS="asia/india asia/nepal". |
GEOFABRIK_BASE |
https://download.geofabrik.de |
Mirror base URL |
JAVA_OPTS_BUILD |
-Xms16g -Xmx48g |
Import heap |
GRAPH_CACHE_URL |
unset | r2://... upload target; unset = skip upload |
KEEP_PBF |
0 |
1 keeps downloaded/merged PBFs (debugging) |
SKIP_DOWNLOAD |
0 |
1 imports from an existing /data/osm/merged.osm.pbf (needs a prior KEEP_PBF=1 run) — useful for iterating on routing profiles |
To iterate on the routing config (profiles, custom models) without re-downloading, keep the merged PBF from a first run, then rebuild with SKIP_DOWNLOAD=1 and mount a tweaked config at /opt/graphhopper/custom.yml via GRAPHHOPPER_CONFIG.