# docker/docker-compose.test.yml - Test environment
# Used by: TestContainerManager (automated) or manual `docker compose -f docker/docker-compose.test.yml up`
#
# This file is the SINGLE SOURCE OF TRUTH for test container configuration.
# All values use environment variable substitution from .env files.
# No persistent volumes - tests start fresh each run.
#
# Requirements: 0.4, 15.2, 16.2, 16.4, 16.5, 17.2
services:
postgres-test:
image: pgvector/pgvector:pg16
container_name: ${TEST_CONTAINER_PREFIX:-thought-test}-postgres
environment:
POSTGRES_USER: ${TEST_DB_USER:-thought_test}
POSTGRES_PASSWORD: ${TEST_DB_PASSWORD:-test_password}
POSTGRES_DB: ${TEST_DB_NAME:-thought_test}
POSTGRES_INITDB_ARGS: "-E UTF8"
ports:
- "${TEST_DB_PORT:-5433}:5432"
volumes:
# Initialize database with schema (no persistent volumes for tests)
- ../packages/server/scripts/db/init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
- ../packages/server/scripts/db/enable-pgvector.sql:/docker-entrypoint-initdb.d/02-enable-pgvector.sql:ro
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${TEST_DB_USER:-thought_test} -d ${TEST_DB_NAME:-thought_test}",
]
interval: 5s
timeout: 3s
retries: 10
start_period: 5s
networks:
- thought-test
ollama-test:
image: ollama/ollama:latest
container_name: ${TEST_CONTAINER_PREFIX:-thought-test}-ollama
# Use custom entrypoint to pull both embedding and inference models
entrypoint: ["/bin/sh", "/ollama-entrypoint.sh"]
environment:
# Model configuration - read from env with defaults
EMBEDDING_MODEL: ${TEST_EMBEDDING_MODEL:-nomic-embed-text}
LLM_MODEL: ${TEST_LLM_MODEL:-llama3.2:1b}
OLLAMA_WAIT_TIMEOUT: ${OLLAMA_WAIT_TIMEOUT:-120}
ports:
- "${TEST_OLLAMA_PORT:-11435}:11434"
volumes:
# Mount the entrypoint script
- ./ollama-entrypoint.sh:/ollama-entrypoint.sh:ro
healthcheck:
# Verify embedding model is available (required for tests)
test: ["CMD-SHELL", "ollama list | grep -q '${TEST_EMBEDDING_MODEL:-nomic-embed-text}'"]
interval: 5s
timeout: 10s
retries: 30
start_period: 60s
networks:
- thought-test
networks:
thought-test:
driver: bridge