60fb84e306
- 更新Woodpecker CI配置 - 更新Docker Compose配置 - 更新应用主类配置 - 更新网关路由服务 - 更新审计日志相关代码
116 lines
2.9 KiB
YAML
116 lines
2.9 KiB
YAML
version: '3.8'
|
|
|
|
x-common-env: &common-env
|
|
TZ: Asia/Shanghai
|
|
LANG: zh_CN.UTF-8
|
|
|
|
services:
|
|
# PostgreSQL数据库服务(测试环境)
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: novalon-postgres-test
|
|
environment:
|
|
<<: *common-env
|
|
POSTGRES_DB: manage_system_test
|
|
POSTGRES_USER: novalon_test
|
|
POSTGRES_PASSWORD: novalon_test123
|
|
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=zh_CN.UTF-8"
|
|
ports:
|
|
- "55433:5432"
|
|
volumes:
|
|
- postgres_test_data:/var/lib/postgresql/data
|
|
- ./novalon-manage-api/manage-db/src/main/resources/db/migration:/docker-entrypoint-initdb.d
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U novalon_test -d manage_system_test"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
networks:
|
|
- novalon-test-network
|
|
|
|
# 后端API服务(测试环境)
|
|
backend:
|
|
build:
|
|
context: ./novalon-manage-api
|
|
dockerfile: Dockerfile
|
|
args:
|
|
- BUILD_VERSION=test
|
|
container_name: novalon-backend-test
|
|
environment:
|
|
<<: *common-env
|
|
SPRING_PROFILES_ACTIVE: test
|
|
SPRING_R2DBC_URL: r2dbc:postgresql://postgres:5432/manage_system_test
|
|
SPRING_R2DBC_USERNAME: novalon_test
|
|
SPRING_R2DBC_PASSWORD: novalon_test123
|
|
SPRING_JACKSON_TIME_ZONE: Asia/Shanghai
|
|
MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: health,info,metrics
|
|
ports:
|
|
- "8085:8084"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8084/actuator/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
networks:
|
|
- novalon-test-network
|
|
|
|
# 前端Web服务(测试环境)
|
|
frontend:
|
|
build:
|
|
context: ./novalon-manage-web
|
|
dockerfile: Dockerfile
|
|
args:
|
|
- BUILD_VERSION=test
|
|
container_name: novalon-frontend-test
|
|
ports:
|
|
- "3002:80"
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
environment:
|
|
<<: *common-env
|
|
- VITE_API_BASE_URL=http://backend:8084
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:80"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
networks:
|
|
- novalon-test-network
|
|
|
|
# E2E测试服务
|
|
e2e-tests:
|
|
build:
|
|
context: ./novalon-manage-web
|
|
dockerfile: Dockerfile.playwright
|
|
container_name: novalon-e2e-tests
|
|
depends_on:
|
|
frontend:
|
|
condition: service_healthy
|
|
backend:
|
|
condition: service_healthy
|
|
environment:
|
|
<<: *common-env
|
|
TEST_BASE_URL: http://frontend:80
|
|
PLAYWRIGHT_HEADLESS: "true"
|
|
CI: "true"
|
|
networks:
|
|
- novalon-test-network
|
|
command: npm run test:e2e:journeys
|
|
|
|
volumes:
|
|
postgres_test_data:
|
|
driver: local
|
|
|
|
networks:
|
|
novalon-test-network:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 172.21.0.0/16 |