A lightweight, performance-optimized PostgreSQL image with PostGIS spatial extensions. Built on Alpine Linux for minimal size while maintaining full spatial database functionality.
- 🗜️ Lean Build: ~329MB image size (vs 600MB+ for standard PostGIS)
- 🚀 Performance Focused: Optimized for speed and resource efficiency
- 🧩 Core PostGIS: Full support for geometry types and spatial functions
- 🔄 Multi-Architecture: Native support for both ARM64 and AMD64 platforms
- 🧪 Thoroughly Tested: Comprehensive test suite ensures reliability
- 🔒 Secure Base: Built on official PostgreSQL Alpine images
- 📦 Latest Versions: PostgreSQL 17 + PostGIS 3.5.3
- ✅ Core PostGIS spatial types and functions
- ✅ GEOS geometry engine
- ✅ PROJ coordinate transformation library
- ✅ Spatial indexing (GIST)
- ✅ Spatial relationships (contains, within, etc.)
- ✅ Distance calculations
- ✅ Coordinate transformations
- ❌ Raster support
- ❌ Topology extension
- ❌ Tiger geocoder
- ❌ GUI tools
# Pull the image
docker pull ghcr.io/clevercactus-dev/docker-lean-postgis:latest
# Run a container
docker run -d \
--name postgis \
-e POSTGRES_PASSWORD=mysecretpassword \
-e POSTGRES_DB=mydb \
-p 5432:5432 \
ghcr.io/clevercactus-dev/docker-lean-postgis:latestThe following tagging scheme is used for this image:
| Tag | Description |
|---|---|
latest |
Latest stable build from the main branch |
RELEASE.YYYY-MM-DDTHH-mm-ssZ |
Timestamped release builds from main branch |
main-sha |
Specific commit from main branch |
branch-YYYY-MM-DDTHH-mm-ssZ |
Timestamped builds from other branches |
branch-sha |
Specific commit from other branches |
All images are multi-architecture and will automatically use the appropriate version for your platform (AMD64 or ARM64).
| Variable | Description | Default |
|---|---|---|
POSTGRES_PASSWORD |
PostgreSQL password (required) | - |
POSTGRES_USER |
PostgreSQL username | postgres |
POSTGRES_DB |
Database name | postgres |
PGDATA |
Data directory | /var/lib/postgresql/data |
All standard PostgreSQL environment variables are supported. See the official PostgreSQL Docker documentation for more details.
version: '3'
services:
postgis:
image: ghcr.io/clevercactus-dev/docker-lean-postgis:latest
environment:
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_DB: mydb
ports:
- "5432:5432"
volumes:
- postgis-data:/var/lib/postgresql/data
volumes:
postgis-data:To build the image locally:
# Clone the repository
git clone https://github.com/clevercactus-dev/docker-lean-postgis.git
cd docker-lean-postgis
# Build the image
docker build -t docker-lean-postgis:latest .docker buildx create --name mybuilder --use
docker buildx build --platform linux/amd64,linux/arm64 -t docker-lean-postgis:latest .The repository includes a comprehensive test script that verifies:
- Core PostGIS functionality
- Spatial operations
- Excluded features are properly removed
- Image size
Run the tests with:
./test-image.shContributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request
- Keep the image size as small as possible
- Maintain compatibility with the official PostgreSQL image
- Add comprehensive tests for new features
- Document any new features or changes
This project is licensed under the MIT License - see the LICENSE file for details.