-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
44 lines (42 loc) · 1.29 KB
/
docker-compose.test.yml
File metadata and controls
44 lines (42 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
version: "3.8"
services:
postgres:
build:
context: .
args:
PG_MAJOR: ${PG_MAJOR:-16}
POSTGIS_MAJOR_VERSION: ${POSTGIS_MAJOR_VERSION:-3}
PGVECTOR_VERSION: ${PGVECTOR_VERSION:-v0.7.2}
environment:
POSTGRES_PASSWORD: test
POSTGRES_USER: test
POSTGRES_DB: test
ADDITIONAL_DATABASES: test2
healthcheck:
test: ["CMD-SHELL", "pg_isready -U test"]
interval: 5s
timeout: 5s
retries: 5
test:
image: postgres:${PG_MAJOR:-16}
depends_on:
postgres:
condition: service_healthy
volumes:
- ./tests:/tests
environment:
PGHOST: postgres
PGUSER: test
PGPASSWORD: test
PGDATABASE: test
command: >
bash -c '
psql -c "SELECT postgis_version();" &&
psql -c "SELECT postgis_full_version();" &&
psql -c "CREATE EXTENSION IF NOT EXISTS vector;" &&
psql -c "CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));" &&
psql -c "INSERT INTO items (embedding) VALUES ('\''[1,2,3]'\'');" &&
psql -c "SELECT * FROM items WHERE embedding <-> '\''[3,2,1]'\'' < 5;" &&
psql -d test2 -c "SELECT postgis_version();" &&
psql -d test2 -c "SELECT * FROM pg_extension WHERE extname = '\''vector'\'';"
'