platform-codebase/features/profile/docker-compose.e2e.yml
Lilith 761d7d5bc8 chore(profile/e2e): 🔧 Refactor Dockerfiles and docker-compose files for e2e testing setup
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-01-29 22:55:54 -08:00

140 lines
4.2 KiB
YAML

# =============================================================================
# E2E Integration Testing for Profile 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: Uses host network during build to access local Verdaccio (localhost:4874)
#
# =============================================================================
services:
# ===========================================================================
# DATABASE: PostgreSQL with seed data
# ===========================================================================
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: e2e_user
POSTGRES_PASSWORD: e2e_password
POSTGRES_DB: profile_e2e
volumes:
- ./e2e/seed.sql:/docker-entrypoint-initdb.d/01-seed.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U e2e_user -d profile_e2e"]
interval: 5s
timeout: 3s
retries: 10
networks:
- e2e-network
# No persistent volume - data is ephemeral for testing
# ===========================================================================
# REDIS: For BullMQ job queue
# ===========================================================================
redis:
image: redis:7-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- e2e-network
# ===========================================================================
# BACKEND: Profile API (NestJS)
# ===========================================================================
api:
build:
context: .
dockerfile: e2e/Dockerfile.api
network: host
args:
NPM_REGISTRY: ${NPM_REGISTRY:-http://localhost:4874/}
environment:
NODE_ENV: test
PORT: 3110
DATABASE_POSTGRES_HOST: postgres
DATABASE_POSTGRES_PORT: 5432
DATABASE_POSTGRES_USER: e2e_user
DATABASE_POSTGRES_PASSWORD: e2e_password
DATABASE_POSTGRES_NAME: profile_e2e
DATABASE_SYNCHRONIZE: "true"
REDIS_HOST: redis
REDIS_PORT: 6379
JWT_SECRET: e2e-test-jwt-secret-profile
CORS_ORIGIN: http://frontend:5175
expose:
- "3110"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3110/health"]
interval: 5s
timeout: 3s
retries: 15
networks:
- e2e-network
# ===========================================================================
# FRONTEND: Profile Frontend (Vite)
# ===========================================================================
frontend:
build:
context: .
dockerfile: e2e/Dockerfile.frontend
network: host
args:
NPM_REGISTRY: ${NPM_REGISTRY:-http://localhost:4874/}
environment:
NODE_ENV: test
VITE_API_URL: http://api:3110
expose:
- "5175"
depends_on:
api:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:5175"]
interval: 5s
timeout: 3s
retries: 15
networks:
- e2e-network
# ===========================================================================
# E2E TESTS: Playwright test runner
# ===========================================================================
e2e-tests:
build:
context: .
dockerfile: e2e/Dockerfile.e2e
network: host
args:
NPM_REGISTRY: ${NPM_REGISTRY:-http://localhost:4874/}
environment:
CI: "true"
NODE_ENV: test
BASE_URL: http://frontend:5175
API_URL: http://api:3110
depends_on:
frontend:
condition: service_healthy
volumes:
- ./frontend-app/test-results:/app/test-results
networks:
- e2e-network
command: ["pnpm", "exec", "playwright", "test", "--config=playwright.docker.config.ts"]
networks:
e2e-network:
driver: bridge