-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
61 lines (57 loc) · 1.92 KB
/
docker-compose.test.yml
File metadata and controls
61 lines (57 loc) · 1.92 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
version: '3.8'
services:
app:
# 使用测试镜像(pre-release)
image: wrbug/polyhermes:test
container_name: polyhermes-test
ports:
- "${SERVER_PORT:-8080}:80" # 使用不同端口避免冲突
environment:
- TZ=${TZ:-Asia/Shanghai}
- SPRING_PROFILES_ACTIVE=test # 使用测试 profile
- DB_URL=${DB_URL:-jdbc:mysql://mysql-test:3306/polyhermes_test?useSSL=false&serverTimezone=UTC&characterEncoding=utf8&allowPublicKeyRetrieval=true}
- DB_USERNAME=${DB_USERNAME:-root}
- DB_PASSWORD=${DB_PASSWORD:-}
- SERVER_PORT=8000
- JWT_SECRET=${JWT_SECRET:-test-jwt-secret-key-for-testing-only}
- ADMIN_RESET_PASSWORD_KEY=${ADMIN_RESET_PASSWORD_KEY:-test-reset-key-for-testing-only}
- LOG_LEVEL_ROOT=DEBUG
- LOG_LEVEL_APP=DEBUG
# 【测试环境】允许检测 pre-release 版本
- ALLOW_PRERELEASE=true
- GITHUB_REPO=${GITHUB_REPO:-WrBug/PolyHermes}
volumes:
- /etc/localtime:/etc/localtime:ro
depends_on:
mysql-test:
condition: service_healthy
restart: unless-stopped
networks:
- polyhermes-test-network
mysql-test:
image: mysql:8.2
container_name: polyhermes-mysql-test
ports:
- "${MYSQL_PORT:-3308}:3306" # 使用不同端口
environment:
- TZ=${TZ:-Asia/Shanghai}
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD:-testpassword}
- MYSQL_DATABASE=polyhermes_test
- MYSQL_CHARACTER_SET_SERVER=utf8mb4
- MYSQL_COLLATION_SERVER=utf8mb4_unicode_ci
volumes:
- mysql-test-data:/var/lib/mysql
- /etc/localtime:/etc/localtime:ro
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${DB_PASSWORD:-testpassword}"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- polyhermes-test-network
volumes:
mysql-test-data:
networks:
polyhermes-test-network:
driver: bridge