Maintain a Dockerized Postgres 17 instance (Debian trixie) with pgvector compiled and available by default using multi-stage builds.
Maintain a Dockerized Postgres 17 instance (Debian trixie) with pgvector compiled and available by default.
When generating or modifying code for this project:
1. **Keep changes minimal and scoped** to the specific task at hand
2. **Do not introduce unrelated tools or refactors** beyond what is requested
3. **Maintain version consistency**: Keep builder and final stages on the same Postgres major/OS tag (`postgres:17-trixie`)
4. **Respect existing environment variables** and defaults (`POSTGRES_DB`, `POSTGRES_USER`, `POSTGRES_PASSWORD`)
5. **Preserve initialization semantics**: `db/init` scripts should run only on first initialization
6. **Do not ship build artifacts**: Build tools and apt caches must not be present in the final image
The Dockerfile must use a **multi-stage build**:
Ensure `db/init/001_extensions.sql` contains:
```sql
CREATE EXTENSION IF NOT EXISTS vector;
```
Include commented examples for common extensions:
1. Update both `FROM` lines in Dockerfile to new version tag (e.g., `postgres:18-trixie`)
2. Update `ARG PG_MAJOR` to match (e.g., `18`)
3. Ensure `postgresql-server-dev-XX` package name matches new major version
**Do not**:
```bash
docker-compose build
docker-compose up -d
docker-compose exec db psql -U postgres -c "CREATE EXTENSION vector;"
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/dockerized-postgres-with-pgvector/raw