{"id":41453681,"url":"https://github.com/jobrunner/spatialite-base-image","last_synced_at":"2026-01-23T15:33:20.870Z","repository":{"id":329041822,"uuid":"1117870603","full_name":"jobrunner/spatialite-base-image","owner":"jobrunner","description":"Multi-arch Docker images (amd64/arm64) with GDAL, SQLite, SpatiaLite, GEOS, and librttopo for geospatial applications.","archived":false,"fork":false,"pushed_at":"2025-12-19T12:01:06.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-20T14:58:50.850Z","etag":null,"topics":["docker-image","gdal","golang","spatialite"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jobrunner.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-16T23:58:00.000Z","updated_at":"2025-12-19T11:52:18.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jobrunner/spatialite-base-image","commit_stats":null,"previous_names":["jobrunner/spatialite-base-image"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/jobrunner/spatialite-base-image","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobrunner%2Fspatialite-base-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobrunner%2Fspatialite-base-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobrunner%2Fspatialite-base-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobrunner%2Fspatialite-base-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jobrunner","download_url":"https://codeload.github.com/jobrunner/spatialite-base-image/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobrunner%2Fspatialite-base-image/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28694657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T14:15:13.573Z","status":"ssl_error","status_checked_at":"2026-01-23T14:09:05.534Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-image","gdal","golang","spatialite"],"created_at":"2026-01-23T15:33:20.111Z","updated_at":"2026-01-23T15:33:20.842Z","avatar_url":"https://github.com/jobrunner.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpatiaLite Docker Images\n\n[![CI](https://github.com/jobrunner/spatialite-base-image/actions/workflows/ci.yml/badge.svg)](https://github.com/jobrunner/spatialite-base-image/actions/workflows/ci.yml)\n[![Release](https://img.shields.io/github/v/release/jobrunner/spatialite-base-image?label=version)](https://github.com/jobrunner/spatialite-base-image/releases)\n[![Container Registry](https://img.shields.io/badge/ghcr.io-packages-blue)](https://github.com/jobrunner/spatialite-base-image/pkgs/container/spatialite-base-image)\n\nMulti-architecture Docker images (amd64/arm64) with GDAL, SQLite, SpatiaLite, GEOS, and librttopo.\n\n## Images\n\n### Versioning\n\nImages use semantic versioning. When you tag a release `v1.2.3`, the following tags are created:\n\n| Tag Pattern | Example | Description |\n|-------------|---------|-------------|\n| `X.Y.Z` | `1.2.3` | Exact version (immutable) |\n| `X.Y` | `1.2` | Latest patch of minor version |\n| `X` | `1` | Latest minor/patch of major version |\n| `latest` | - | Latest release (use with caution) |\n\n**Recommendation:** Use exact versions (`1.2.3`) for reproducible builds. Use `X.Y` for automatic patch updates.\n\n### Runtime Images (for Production)\n\nMinimal images containing only runtime libraries. Use these for your final production containers.\n\n```\nghcr.io/jobrunner/spatialite-base-image:alpine-1.4.0\nghcr.io/jobrunner/spatialite-base-image:ubuntu-1.4.0\nghcr.io/jobrunner/spatialite-base-image:1.4.0          # Alpine (default)\n```\n\n| Base | Tags |\n|------|------|\n| Alpine 3.21 | `alpine-X.Y.Z`, `alpine-X.Y`, `alpine-X`, `alpine-latest`, `X.Y.Z`, `X.Y`, `X`, `latest` |\n| Ubuntu 26.04 | `ubuntu-X.Y.Z`, `ubuntu-X.Y`, `ubuntu-X`, `ubuntu-latest` |\n\n### Development Images (for Building)\n\nImages with development headers, pkg-config files, and build tools (gcc, g++). Use these to compile applications with CGO bindings.\n\n```\nghcr.io/jobrunner/spatialite-base-image:alpine-dev-1.4.0\nghcr.io/jobrunner/spatialite-base-image:ubuntu-dev-1.4.0\nghcr.io/jobrunner/spatialite-base-image:dev-1.4.0       # Alpine (default)\n```\n\n| Base | Tags |\n|------|------|\n| Alpine 3.21 | `alpine-dev-X.Y.Z`, `alpine-dev-X.Y`, `alpine-dev-X`, `alpine-dev-latest`, `dev-X.Y.Z`, `dev-X.Y`, `dev-X`, `dev` |\n| Ubuntu 26.04 | `ubuntu-dev-X.Y.Z`, `ubuntu-dev-X.Y`, `ubuntu-dev-X`, `ubuntu-dev-latest` |\n\n## Why Separate Dev and Runtime Images?\n\nWhen building Go applications with CGO bindings (like GDAL or SpatiaLite), the compiled binary links against shared libraries (`.so` files). **The library versions must match between build and runtime.**\n\n### The Problem\n\nIf you build in `golang:alpine` and run in a different SpatiaLite image:\n\n```dockerfile\n# DON'T DO THIS - version mismatch risk!\nFROM golang:1.23-alpine AS builder\nRUN apk add gdal-dev  # installs version X\n# ... build ...\n\nFROM some-other-spatialite-image  # has version Y\nCOPY --from=builder /app/myapp .  # may crash or behave unexpectedly\n```\n\n### The Solution\n\nUse matching dev/runtime image pairs from this repository with the **same version tag**:\n\n```dockerfile\n# BUILD with dev image\nFROM ghcr.io/jobrunner/spatialite-base-image:alpine-dev-1.4.0 AS builder\n# ... install Go, build ...\n\n# RUN with matching runtime image (same version!)\nFROM ghcr.io/jobrunner/spatialite-base-image:alpine-1.4.0\nCOPY --from=builder /app/myapp .\n```\n\nBoth images are built from the same base in the same CI pipeline, guaranteeing identical library versions.\n\n## Included Libraries\n\n- **GDAL** - Geospatial Data Abstraction Library\n- **SQLite** - Database engine\n- **SpatiaLite** - Spatial extension for SQLite\n- **GEOS** - Geometry Engine Open Source\n- **librttopo** - RT Topology Library\n- **PROJ** - Coordinate transformation library\n\nDev images additionally include:\n- **gcc/g++** - C/C++ compilers\n- **pkg-config** - Library configuration tool\n- **Development headers** (`.h` files) for all libraries\n\n## Environment Variables\n\nAll images have these pre-configured:\n\n```\nSPATIALITE_SECURITY=relaxed\nSQLITE_ENABLE_LOAD_EXTENSION=1\nLD_LIBRARY_PATH=/usr/lib:/usr/local/lib\n```\n\n## Security\n\nAll images include security hardening:\n\n- **Non-root user**: Images run as `spatialite` user (UID 10001) by default\n- **No SUID/SGID**: All SUID/SGID bits are removed from binaries\n- **Minimal attack surface**: Only required packages are installed\n\n### Running as root (when needed)\n\nDev images can be run as root for tasks requiring elevated privileges:\n\n```bash\ndocker run --user root -it ghcr.io/jobrunner/spatialite-base-image:alpine-dev-1.4.0 sh\n```\n\n### Production hardening\n\nFor maximum security in production:\n\n```bash\ndocker run --rm \\\n  --read-only \\\n  --security-opt=no-new-privileges:true \\\n  --cap-drop=ALL \\\n  -v $(pwd)/data:/data \\\n  ghcr.io/jobrunner/spatialite-base-image:1.4.0\n```\n\n## Usage\n\n### Basic Usage\n\n```bash\n# Run SQLite with SpatiaLite\ndocker run --rm -it ghcr.io/jobrunner/spatialite-base-image:1.4.0\n\n# Load SpatiaLite extension\nsqlite\u003e SELECT load_extension('mod_spatialite');\nsqlite\u003e SELECT spatialite_version();\n```\n\n### Mount Local Data\n\n```bash\ndocker run --rm -it \\\n  -v $(pwd)/data:/data \\\n  ghcr.io/jobrunner/spatialite-base-image:1.4.0 \\\n  sqlite3 /data/mydb.sqlite\n```\n\n## Multi-Stage Build for Go Applications\n\n### Recommended: Alpine-based Build\n\n```dockerfile\n# =============================================================================\n# Build stage - use the dev image with all headers and build tools\n# =============================================================================\nFROM ghcr.io/jobrunner/spatialite-base-image:alpine-dev-1.4.0 AS builder\n\n# Install Go\nRUN apk add --no-cache go\n\nWORKDIR /app\n\n# Copy go module files first (better layer caching)\nCOPY go.mod go.sum ./\nRUN go mod download\n\n# Copy source code\nCOPY . .\n\n# Build with CGO enabled\n# The dev image has pkg-config set up correctly for all libraries\nRUN CGO_ENABLED=1 go build -o /app/myapp .\n\n# =============================================================================\n# Runtime stage - use the minimal runtime image (SAME VERSION!)\n# =============================================================================\nFROM ghcr.io/jobrunner/spatialite-base-image:alpine-1.4.0\n\n# Copy only the binary from builder\nCOPY --from=builder /app/myapp /usr/local/bin/myapp\n\nENTRYPOINT [\"/usr/local/bin/myapp\"]\n```\n\n### Ubuntu-based Build (for glibc compatibility)\n\nSome Go libraries require glibc. Use the Ubuntu variants:\n\n```dockerfile\n# Build stage\nFROM ghcr.io/jobrunner/spatialite-base-image:ubuntu-dev-1.4.0 AS builder\n\n# Install Go\nRUN apt-get update \u0026\u0026 apt-get install -y --no-install-recommends golang-go \\\n    \u0026\u0026 rm -rf /var/lib/apt/lists/*\n\nWORKDIR /app\nCOPY go.mod go.sum ./\nRUN go mod download\nCOPY . .\nRUN CGO_ENABLED=1 go build -o /app/myapp .\n\n# Runtime stage (SAME VERSION!)\nFROM ghcr.io/jobrunner/spatialite-base-image:ubuntu-1.4.0\n\nCOPY --from=builder /app/myapp /usr/local/bin/myapp\nENTRYPOINT [\"/usr/local/bin/myapp\"]\n```\n\n### Using Specific GDAL CGO Flags\n\nIf you need explicit CGO flags (e.g., for [lukeroth/gdal](https://github.com/lukeroth/gdal)):\n\n```dockerfile\nFROM ghcr.io/jobrunner/spatialite-base-image:alpine-dev-1.4.0 AS builder\n\nRUN apk add --no-cache go\n\nWORKDIR /app\nCOPY go.mod go.sum ./\nRUN go mod download\nCOPY . .\n\n# Use pkg-config to get the correct flags\nRUN CGO_ENABLED=1 \\\n    CGO_CFLAGS=\"$(pkg-config --cflags gdal)\" \\\n    CGO_LDFLAGS=\"$(pkg-config --libs gdal)\" \\\n    go build -o /app/myapp .\n\nFROM ghcr.io/jobrunner/spatialite-base-image:alpine-1.4.0\nCOPY --from=builder /app/myapp /usr/local/bin/myapp\nENTRYPOINT [\"/usr/local/bin/myapp\"]\n```\n\n## Go Code Example\n\n### Using mattn/go-sqlite3 with SpatiaLite\n\n```go\npackage main\n\nimport (\n    \"database/sql\"\n    \"fmt\"\n    \"log\"\n\n    _ \"github.com/mattn/go-sqlite3\"\n)\n\nfunc main() {\n    // Open database with SpatiaLite extension\n    db, err := sql.Open(\"sqlite3\", \"file:test.db?_load_extension=mod_spatialite\")\n    if err != nil {\n        log.Fatal(err)\n    }\n    defer db.Close()\n\n    // Initialize spatial metadata\n    _, err = db.Exec(\"SELECT InitSpatialMetaData(1)\")\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Create a spatial table\n    _, err = db.Exec(`\n        CREATE TABLE IF NOT EXISTS locations (\n            id INTEGER PRIMARY KEY,\n            name TEXT\n        )\n    `)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Add geometry column\n    db.Exec(`SELECT AddGeometryColumn('locations', 'geom', 4326, 'POINT', 'XY')`)\n\n    // Insert a point\n    _, err = db.Exec(`\n        INSERT INTO locations (name, geom)\n        VALUES ('Berlin', GeomFromText('POINT(13.405 52.52)', 4326))\n    `)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Query with spatial function\n    var name string\n    var wkt string\n    err = db.QueryRow(`\n        SELECT name, AsText(geom) FROM locations WHERE id = 1\n    `).Scan(\u0026name, \u0026wkt)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    fmt.Printf(\"Location: %s at %s\\n\", name, wkt)\n}\n```\n\n### go.mod\n\n```go\nmodule myapp\n\ngo 1.23\n\nrequire github.com/mattn/go-sqlite3 v1.14.24\n```\n\n## Building Images Locally\n\n```bash\n# Build Alpine runtime\ndocker build -f Dockerfile.alpine -t spatialite:alpine .\n\n# Build Alpine dev\ndocker build -f Dockerfile.alpine-dev -t spatialite:alpine-dev .\n\n# Build Ubuntu runtime\ndocker build -f Dockerfile.ubuntu -t spatialite:ubuntu .\n\n# Build Ubuntu dev\ndocker build -f Dockerfile.ubuntu-dev -t spatialite:ubuntu-dev .\n\n# Multi-arch build\ndocker buildx build --platform linux/amd64,linux/arm64 \\\n  -f Dockerfile.alpine -t spatialite:alpine .\n```\n\n## Testing\n\n```bash\n# Test runtime image\ndocker run --rm -v $(pwd)/tests:/tests spatialite:alpine /tests/test-image.sh\n\n# Test dev image\ndocker run --rm -v $(pwd)/tests:/tests spatialite:alpine-dev sh -c \\\n  \"/tests/test-image.sh \u0026\u0026 /tests/test-dev-image.sh\"\n```\n\n## Development Workflow\n\n### Branch Protection\n\nDirect commits to `main` are not allowed. All changes must go through a Pull Request.\n\n### Creating a Release\n\n1. **Create a feature branch:**\n   ```bash\n   git checkout -b feature/my-change\n   ```\n\n2. **Make your changes and update VERSION file:**\n   ```bash\n   echo \"1.1.0\" \u003e VERSION\n   ```\n\n3. **Update CHANGELOG.md** with your changes\n\n4. **Push and create Pull Request:**\n   ```bash\n   git push -u origin feature/my-change\n   ```\n\n5. **Wait for CI to pass** (build + test)\n\n6. **Merge to main** - this automatically:\n   - Creates a git tag `v1.1.0` from VERSION file\n   - Builds and pushes all Docker image tags\n   - Creates a GitHub Release with CHANGELOG\n\n## License\n\nGPL-2.0-or-later\n\nThis project is licensed under the GNU General Public License v2.0 or later due to the inclusion of GPL-licensed components (librttopo). See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjobrunner%2Fspatialite-base-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjobrunner%2Fspatialite-base-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjobrunner%2Fspatialite-base-image/lists"}