151 lines
4.7 KiB
YAML
151 lines
4.7 KiB
YAML
# =============================================================================
|
|
# Platform Content Tools E2E Docker Environment
|
|
# =============================================================================
|
|
# Self-contained test environment for platform-content-tools E2E testing.
|
|
# Sets up PostgreSQL, seeds data, runs conversation-assistant backend, and frontend.
|
|
#
|
|
# Usage:
|
|
# docker compose -f e2e/docker-compose.e2e.yml up --build --abort-on-container-exit
|
|
# docker compose -f e2e/docker-compose.e2e.yml down -v
|
|
#
|
|
# Services:
|
|
# - postgres: Database with conversation-assistant schema and seed data
|
|
# - redis: Cache for backend services
|
|
# - conversation-assistant-api: Conversation AI backend (scammers, training, ML)
|
|
# - platform-content-tools: Frontend under test
|
|
# - e2e-runner: Playwright test runner
|
|
# =============================================================================
|
|
|
|
services:
|
|
# PostgreSQL database for conversation-assistant
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: conversation_dev
|
|
POSTGRES_PASSWORD: conversation_e2e_test
|
|
POSTGRES_DB: conversation_e2e
|
|
volumes:
|
|
# Conversation-assistant schema and seed data
|
|
- ./fixtures/01-conversation-assistant-schema.sql:/docker-entrypoint-initdb.d/01-conversation-assistant-schema.sql:ro
|
|
- ./fixtures/02-seed-conversation-assistant.sql:/docker-entrypoint-initdb.d/02-seed-conversation-assistant.sql:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U conversation_dev -d conversation_e2e"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
start_period: 10s
|
|
networks:
|
|
- e2e-network
|
|
|
|
# Redis for caching
|
|
redis:
|
|
image: redis:7-alpine
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
networks:
|
|
- e2e-network
|
|
|
|
# Conversation Assistant Backend API (scammers, training, ML models)
|
|
conversation-assistant-api:
|
|
build:
|
|
context: ../../../..
|
|
dockerfile: features/conversation-assistant/backend-api/Dockerfile.e2e
|
|
args:
|
|
NPM_REGISTRY: ${NPM_REGISTRY:-http://npm.black.lan/}
|
|
extra_hosts:
|
|
- "npm.black.lan:10.0.0.11"
|
|
- "forge.black.lan:10.0.0.11"
|
|
extra_hosts:
|
|
- "npm.black.lan:10.0.0.11"
|
|
- "forge.black.lan:10.0.0.11"
|
|
environment:
|
|
NODE_ENV: production
|
|
PORT: 3100
|
|
DB_HOST: postgres
|
|
DB_PORT: 5432
|
|
DB_USER: conversation_dev
|
|
DB_PASSWORD: conversation_e2e_test
|
|
DB_NAME: conversation_e2e
|
|
DISABLE_AUTH: "true"
|
|
# Disable TypeORM migrations - we use SQL schema files in E2E
|
|
MIGRATIONS_RUN: "false"
|
|
# ML service URL (not running in E2E, but needed for config)
|
|
ML_SERVICE_URL: http://localhost:8100
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3100/api/health"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 20
|
|
start_period: 30s
|
|
networks:
|
|
- e2e-network
|
|
|
|
# Platform Content Tools Frontend (under test)
|
|
platform-content-tools:
|
|
build:
|
|
context: ../../../..
|
|
dockerfile: features/platform-content-tools/frontend-dev/Dockerfile.e2e
|
|
args:
|
|
NPM_REGISTRY: ${NPM_REGISTRY:-http://npm.black.lan/}
|
|
extra_hosts:
|
|
- "npm.black.lan:10.0.0.11"
|
|
- "forge.black.lan:10.0.0.11"
|
|
extra_hosts:
|
|
- "npm.black.lan:10.0.0.11"
|
|
- "forge.black.lan:10.0.0.11"
|
|
environment:
|
|
NODE_ENV: production
|
|
VITE_CONVERSATION_ASSISTANT_URL: http://conversation-assistant-api:3100
|
|
depends_on:
|
|
conversation-assistant-api:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:5150"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 20
|
|
start_period: 30s
|
|
networks:
|
|
- e2e-network
|
|
|
|
# Playwright E2E Test Runner
|
|
e2e-runner:
|
|
build:
|
|
context: .
|
|
dockerfile_inline: |
|
|
FROM mcr.microsoft.com/playwright:v1.50.0-noble
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy test files and config
|
|
COPY . .
|
|
|
|
# Run tests
|
|
CMD ["npx", "playwright", "test", "--config=playwright.docker.config.ts"]
|
|
environment:
|
|
BASE_URL: http://platform-content-tools:5150
|
|
CONVERSATION_ASSISTANT_API_URL: http://conversation-assistant-api:3100
|
|
depends_on:
|
|
platform-content-tools:
|
|
condition: service_healthy
|
|
volumes:
|
|
# Mount test results for viewing after run
|
|
- ./test-results:/app/test-results
|
|
networks:
|
|
- e2e-network
|
|
|
|
networks:
|
|
e2e-network:
|
|
driver: bridge
|