Guide

Offline geocoding in Docker

One image per country, with the address file inside and checked when the image was built. It serves the same HTTP API as gridpin serve and never connects out.

Run a country

terminalDocker
$ docker run --rm -p 127.0.0.1:8080:8080 ghcr.io/gridpin/gridpin:us
$ curl "http://127.0.0.1:8080/search?q=1600+Pennsylvania+Ave+NW,+Washington,+DC&format=json"

The tag is the country code: us, ca, de, fr, it, es, mx, nl, br, rs. Each tag also comes with the version, such as us-0.7.1, for a fixed deployment. The image is built for linux/amd64; on Apple silicon Docker runs it under emulation. The server inside listens on port 8080 and reports /health to Docker's health check; the paths and answers are the ones of gridpin serve.

Your own file: the engine image

terminalDocker
$ docker run --rm -p 127.0.0.1:8080:8080 \
    -v "$(gridpin-fetch mx):/data/sheet.bin:ro" ghcr.io/gridpin/gridpin:engine

The engine tag has no address file: mount one at /data/sheet.bin.

Several countries

compose.yamlYAML
services:
  geocoder-us:
    image: ghcr.io/gridpin/gridpin:us
    ports: ["127.0.0.1:8080:8080"]
    restart: unless-stopped
  geocoder-ca:
    image: ghcr.io/gridpin/gridpin:ca
    ports: ["127.0.0.1:8081:8080"]
    restart: unless-stopped

One container per country, each on its own port. The containers need no network at run time: the server only listens. The image runs as a non-root user on a distroless base with no shell, and carries the license texts of the engine, its libraries and the data sources in /usr/share/doc/gridpin/.