feat: PostgreSQL image with TimescaleDB, VectorChord, pgvector
Some checks failed
🚀 Docker Build and Push / build-and-push (15) (push) Successful in 7m47s
🚀 Docker Build and Push / build-and-push (16) (push) Successful in 5m42s
🚀 Docker Build and Push / build-and-push (18) (push) Has been cancelled
🚀 Docker Build and Push / build-and-push (17) (push) Has been cancelled

- Multi-stage Dockerfile for optimized image size (676MB vs 2GB)
- Support for PostgreSQL 15, 16, 17, 18
- TimescaleDB 2.24.0, VectorChord 1.0.0, pgvector 0.8.1
- Auto-creation of extensions on first startup
- CI/CD with tests for all versions
- OCI labels and healthcheck included
This commit is contained in:
2025-12-19 11:57:54 +01:00
commit cb58167e53
7 changed files with 288 additions and 0 deletions

90
README.md Normal file
View File

@@ -0,0 +1,90 @@
# TimescaleDB + VectorChord + pgvector
[![Build Status](https://gitea.killinger.fr/maxime.killinger/postgres-ts-vectors/actions/workflows/docker-build.yml/badge.svg)](https://gitea.killinger.fr/maxime.killinger/postgres-ts-vectors/actions)
Docker image combining **PostgreSQL** with three powerful extensions:
- **[TimescaleDB](https://www.timescale.com/)** - Time-series database extension
- **[VectorChord](https://vectorchord.ai/)** - High-performance vector similarity search
- **[pgvector](https://github.com/pgvector/pgvector)** - Open-source vector similarity search
## Supported PostgreSQL Versions
| Tag | PostgreSQL | TimescaleDB | VectorChord | pgvector |
|-----|------------|-------------|-------------|----------|
| `pg15` | 15 | 2.24.0 | 1.0.0 | 0.8.1 |
| `pg16` | 16 | 2.24.0 | 1.0.0 | 0.8.1 |
| `pg17` | 17 | 2.24.0 | 1.0.0 | 0.8.1 |
| `pg18`, `latest` | 18 | 2.24.0 | 1.0.0 | 0.8.1 |
## Quick Start
```bash
docker run -d \
--name my-postgres \
-e POSTGRES_PASSWORD=mysecretpassword \
-p 5432:5432 \
gitea.killinger.fr/maxime.killinger/postgres-ts-vectors:latest
```
All extensions are **automatically created** on first startup.
## Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `POSTGRES_PASSWORD` | PostgreSQL password (required) | - |
| `POSTGRES_USER` | PostgreSQL user | `postgres` |
| `POSTGRES_DB` | Default database | `postgres` |
## Extensions Usage
### TimescaleDB
```sql
-- Create a hypertable
CREATE TABLE conditions (
time TIMESTAMPTZ NOT NULL,
device_id INTEGER,
temperature DOUBLE PRECISION
);
SELECT create_hypertable('conditions', 'time');
```
### VectorChord / pgvector
```sql
-- Create a table with vector embeddings
CREATE TABLE documents (
id SERIAL PRIMARY KEY,
content TEXT,
embedding vector(1536)
);
-- Create an index for fast similarity search
CREATE INDEX ON documents USING vchordrq (embedding vector_l2_ops);
-- Query similar documents
SELECT * FROM documents
ORDER BY embedding <-> '[0.1, 0.2, ...]'
LIMIT 10;
```
## Building Locally
```bash
# Build for PG18
docker build --build-arg PG_VERSION=18 -t my-image:pg18 .
# Build for PG16
docker build --build-arg PG_VERSION=16 -t my-image:pg16 .
```
## License
This project is licensed under the Apache 2.0 License.
- TimescaleDB: [Timescale License](https://github.com/timescale/timescaledb/blob/main/LICENSE)
- VectorChord: [Apache 2.0](https://github.com/tensorchord/VectorChord/blob/main/LICENSE)
- pgvector: [PostgreSQL License](https://github.com/pgvector/pgvector/blob/master/LICENSE)