-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.ci.yml
More file actions
94 lines (87 loc) · 2.17 KB
/
docker-compose.ci.yml
File metadata and controls
94 lines (87 loc) · 2.17 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
# Docker Compose for CI/E2E Testing
# Usage: docker-compose -f docker-compose.ci.yml up -d
# Then run: npm run test:e2e
version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:16-alpine
container_name: backtrader_postgres_ci
environment:
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_password
POSTGRES_DB: test_db
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U test_user"]
interval: 5s
timeout: 5s
retries: 5
networks:
- backtrader_ci
# Redis Cache
redis:
image: redis:7-alpine
container_name: backtrader_redis_ci
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
networks:
- backtrader_ci
# Backend API
backend:
build:
context: ./src/backend
dockerfile: Dockerfile
container_name: backtrader_backend_ci
environment:
DATABASE_URL: postgresql+asyncpg://test_user:test_password@postgres:5432/test_db
REDIS_URL: redis://redis:6379/0
SECRET_KEY: test-secret-key-for-ci
JWT_SECRET_KEY: test-jwt-secret-key-for-ci
HOST: 0.0.0.0
PORT: 8001
CORS_ORIGINS: http://localhost:3000,http://localhost:5173
ports:
- "8001:8001"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- backtrader_ci
# Frontend Dev Server
frontend:
image: node:20-alpine
container_name: backtrader_frontend_ci
working_dir: /app
volumes:
- ./src/frontend:/app
- frontend_node_modules:/app/node_modules
environment:
- VITE_API_BASE_URL=http://localhost:8001/api/v1
ports:
- "3000:3000"
command: sh -c "npm install && npm run dev -- --host 0.0.0.0"
depends_on:
backend:
condition: service_healthy
networks:
- backtrader_ci
networks:
backtrader_ci:
driver: bridge
volumes:
frontend_node_modules: