-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.e2e.yml
More file actions
123 lines (118 loc) · 3.62 KB
/
docker-compose.e2e.yml
File metadata and controls
123 lines (118 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Load environment variables from .env.e2e file
# Copy .env.e2e.example to .env.e2e and fill in your actual values
services:
# ============================================================================
# POSTGRES DATABASE (E2E Test DB)
# ============================================================================
postgres:
image: postgres:17-alpine
container_name: corely_e2e_postgres
restart: unless-stopped
env_file:
- .env.e2e
environment:
# Explicit values so local .env overrides (e.g., POSTGRES_DB=corely) don't
# point the e2e stack at a database name that doesn't exist.
POSTGRES_DB: corely_e2e
POSTGRES_USER: corely
POSTGRES_PASSWORD: corely
ports:
- "5433:5432"
volumes:
- postgres_e2e_data:/var/lib/postgresql/data
- ./docker/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-corely}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- corely_e2e
# ============================================================================
# REDIS CACHE & QUEUE (E2E)
# ============================================================================
redis:
image: redis:7-alpine
container_name: corely_e2e_redis
restart: unless-stopped
env_file:
- .env.e2e
ports:
- "6380:6379"
volumes:
- redis_e2e_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
networks:
- corely_e2e
# ============================================================================
# NESTJS API (E2E - NODE_ENV=test)
# ============================================================================
api:
build:
context: .
dockerfile: Dockerfile.api
container_name: corely_e2e_api
env_file:
- .env.e2e
command: >
sh -c "pnpm --filter @corely/api build &&
cd /app/packages/data && /app/node_modules/.bin/prisma migrate deploy &&
node /app/services/api/dist/main.js"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
NODE_ENV: ${NODE_ENV:-test}
DATABASE_URL: postgresql://corely:corely@postgres:5432/corely_e2e?schema=public
REDIS_URL: redis://redis:6379
LOG_LEVEL: ${LOG_LEVEL:-info}
TEST_HARNESS_SECRET: ${TEST_HARNESS_SECRET:-test-secret-key}
JWT_SECRET: ${JWT_SECRET:-test-jwt-secret-change-me}
RESEND_API_KEY: ${RESEND_API_KEY:-dummy_key_for_e2e}
NODE_OPTIONS: --enable-source-maps
ports:
- "3000:3000"
networks:
- corely_e2e
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/health"]
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
# ============================================================================
# VITE WEB FRONTEND (E2E)
# ============================================================================
web:
build:
context: .
dockerfile: Dockerfile.web
container_name: corely_e2e_web
env_file:
- .env.e2e
restart: unless-stopped
depends_on:
api:
condition: service_healthy
environment:
NODE_ENV: ${NODE_ENV:-test}
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:3000}
ports:
- "8080:8080"
networks:
- corely_e2e
volumes:
postgres_e2e_data:
redis_e2e_data:
networks:
corely_e2e:
driver: bridge