docker-compose.test.yml
Rama main · réplica de lectura del repositorio original.
services:
test-postgres:
image: pgvector/pgvector:pg18@sha256:2ba9ca5f2e7daa0f0e7723cba1ee9167bab54efd3640516a44ac1a928dd67e7a
container_name: novelworld-test-pg
environment:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: novelworld_test
ports:
- "25432:5432"
volumes:
- ./infra/postgres/init.sql:/docker-entrypoint-initdb.d/01_init.sql:ro
healthcheck:
# pg_isready also succeeds against the image's temporary bootstrap
# server. PID 1 becomes postgres only after that server is replaced by
# the final runtime, so migrations cannot race the handoff.
test: ["CMD-SHELL", "test \"$$(cat /proc/1/comm)\" = postgres && pg_isready -U test -d novelworld_test"]
interval: 2s
timeout: 3s
retries: 10
test-migrate:
image: pgvector/pgvector:pg18@sha256:2ba9ca5f2e7daa0f0e7723cba1ee9167bab54efd3640516a44ac1a928dd67e7a
environment:
PGHOST: test-postgres
PGUSER: test
PGPASSWORD: test
PGDATABASE: novelworld_test
volumes:
- ./infra/postgres/migrations:/migrations:ro
depends_on:
test-postgres:
condition: service_healthy
command:
- /bin/sh
- -ec
- |
for migration in /migrations/*.sql; do
psql -v ON_ERROR_STOP=1 -f "$$migration"
done
test-redis:
image: redis:8.10.2-alpine@sha256:3811787313eba226a2ef38658c6ccb91cd5e110edc89c37767de373120a0e5a0
container_name: novelworld-test-redis
ports:
- "26379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 2s
timeout: 3s
retries: 10