123 lines
3.3 KiB
YAML
Executable file
123 lines
3.3 KiB
YAML
Executable file
# SEO Admin E2E Test Environment
|
|
#
|
|
# Self-contained Docker environment for Playwright E2E tests (Admin Frontend).
|
|
# Includes PostgreSQL, Redis, API, and the admin frontend.
|
|
#
|
|
# Usage:
|
|
# docker compose -f docker-compose.e2e.admin.yml up --build --abort-on-container-exit
|
|
# docker compose -f docker-compose.e2e.admin.yml down -v
|
|
|
|
services:
|
|
# PostgreSQL database
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: e2e_user
|
|
POSTGRES_PASSWORD: e2e_password
|
|
POSTGRES_DB: seo_e2e
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U e2e_user -d seo_e2e"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
volumes:
|
|
- ./e2e/seed.sql:/docker-entrypoint-initdb.d/01-seed.sql:ro
|
|
networks:
|
|
- e2e-network
|
|
|
|
# Redis for BullMQ queues and caching
|
|
redis:
|
|
image: redis:7-alpine
|
|
command: redis-server --appendonly yes
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
networks:
|
|
- e2e-network
|
|
|
|
# Backend API (NestJS with PostgreSQL + Redis)
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: e2e/Dockerfile.api
|
|
args:
|
|
NPM_REGISTRY: ${NPM_REGISTRY:-http://npm.nasty.sh/}
|
|
environment:
|
|
NODE_ENV: test
|
|
PORT: 3014
|
|
# Database connection
|
|
DATABASE_HOST: postgres
|
|
DATABASE_PORT: 5432
|
|
DATABASE_USER: e2e_user
|
|
DATABASE_PASSWORD: e2e_password
|
|
DATABASE_NAME: seo_e2e
|
|
DATABASE_SYNCHRONIZE: "true"
|
|
# Redis connection
|
|
REDIS_HOST: redis
|
|
REDIS_PORT: 6379
|
|
# Disable auto-start of dependencies in Docker
|
|
LILITH_DEPENDENCY_STARTUP_DISABLED: "true"
|
|
# CORS origins
|
|
ALLOWED_ORIGINS: "http://localhost:4004,http://frontend-admin:4004"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3014/api/seo/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 30s
|
|
networks:
|
|
- e2e-network
|
|
|
|
# Frontend Admin (Vite preview server)
|
|
frontend-admin:
|
|
build:
|
|
context: .
|
|
dockerfile: e2e/Dockerfile.frontend-admin
|
|
args:
|
|
NPM_REGISTRY: ${NPM_REGISTRY:-http://npm.nasty.sh/}
|
|
environment:
|
|
NODE_ENV: test
|
|
VITE_API_URL: http://api:3014
|
|
depends_on:
|
|
api:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:4004"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 30s
|
|
networks:
|
|
- e2e-network
|
|
|
|
# Playwright E2E test runner
|
|
e2e-tests:
|
|
build:
|
|
context: .
|
|
dockerfile: e2e/Dockerfile.e2e-admin
|
|
args:
|
|
NPM_REGISTRY: ${NPM_REGISTRY:-http://npm.nasty.sh/}
|
|
environment:
|
|
CI: "true"
|
|
BASE_URL: http://frontend-admin:4004/admin/seo
|
|
API_URL: http://api:3014
|
|
depends_on:
|
|
frontend-admin:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./frontend-admin/test-results:/app/test-results
|
|
- ./frontend-admin/playwright-report:/app/playwright-report
|
|
command: ["pnpm", "exec", "playwright", "test", "--config=playwright.docker.config.ts"]
|
|
networks:
|
|
- e2e-network
|
|
|
|
networks:
|
|
e2e-network:
|
|
driver: bridge
|