platform-codebase/features/landing/docker-compose.e2e.yml

138 lines
4.1 KiB
YAML
Executable file

# =============================================================================
# E2E Integration Testing for Landing Feature
# =============================================================================
#
# Full stack E2E testing with database, backend API, and frontend.
# Database is seeded, migrations run, tests execute, then everything tears down.
#
# Usage:
# docker compose -f docker-compose.e2e.yml up --build --abort-on-container-exit
# docker compose -f docker-compose.e2e.yml down -v
#
# Note: NPM_REGISTRY defaults to http://npm.nasty.sh/
#
# =============================================================================
services:
# ===========================================================================
# DATABASE: PostgreSQL with seed data
# ===========================================================================
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: e2e_user
POSTGRES_PASSWORD: e2e_password
POSTGRES_DB: landing_e2e
volumes:
- ./e2e/seed.sql:/docker-entrypoint-initdb.d/01-seed.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U e2e_user -d landing_e2e"]
interval: 5s
timeout: 3s
retries: 10
networks:
- e2e-network
# No persistent volume - data is ephemeral for testing
# ===========================================================================
# BACKEND: Landing API (NestJS)
# ===========================================================================
api:
build:
context: .
dockerfile: e2e/Dockerfile.api
args:
NPM_REGISTRY: ${NPM_REGISTRY:-http://npm.nasty.sh/}
extra_hosts:
- "npm.nasty.sh:10.0.0.11"
- "forge.nasty.sh:10.0.0.11"
extra_hosts:
- "npm.nasty.sh:10.0.0.11"
- "forge.nasty.sh:10.0.0.11"
environment:
NODE_ENV: test
PORT: 3010
DB_HOST: postgres
DB_PORT: 5432
DB_USERNAME: e2e_user
DB_PASSWORD: e2e_password
DB_NAME: landing_e2e
DATABASE_SYNCHRONIZE: "true"
JWT_SECRET: e2e-test-jwt-secret-landing
CORS_ORIGIN: http://frontend:5100
expose:
- "3010"
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3010/health"]
interval: 5s
timeout: 3s
retries: 15
networks:
- e2e-network
# ===========================================================================
# FRONTEND: Landing Frontend (Vite)
# ===========================================================================
frontend:
build:
context: .
dockerfile: e2e/Dockerfile.frontend
args:
NPM_REGISTRY: ${NPM_REGISTRY:-http://npm.nasty.sh/}
extra_hosts:
- "npm.nasty.sh:10.0.0.11"
- "forge.nasty.sh:10.0.0.11"
extra_hosts:
- "npm.nasty.sh:10.0.0.11"
- "forge.nasty.sh:10.0.0.11"
environment:
NODE_ENV: test
VITE_API_URL: http://api:3010
expose:
- "5100"
depends_on:
api:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:5100"]
interval: 5s
timeout: 3s
retries: 15
networks:
- e2e-network
# ===========================================================================
# E2E TESTS: Playwright test runner
# ===========================================================================
e2e-tests:
build:
context: .
dockerfile: e2e/Dockerfile.e2e
args:
NPM_REGISTRY: ${NPM_REGISTRY:-http://npm.nasty.sh/}
extra_hosts:
- "npm.nasty.sh:10.0.0.11"
- "forge.nasty.sh:10.0.0.11"
extra_hosts:
- "npm.nasty.sh:10.0.0.11"
- "forge.nasty.sh:10.0.0.11"
environment:
CI: "true"
NODE_ENV: test
BASE_URL: http://frontend:5100
API_URL: http://api:3010
depends_on:
frontend:
condition: service_healthy
volumes:
- ./frontend-public/test-results:/app/test-results
networks:
- e2e-network
command: ["pnpm", "exec", "playwright", "test", "--config=playwright.docker.config.ts"]
networks:
e2e-network:
driver: bridge