84 lines
2.2 KiB
YAML
84 lines
2.2 KiB
YAML
services:
|
|
# PostgreSQL 数据库服务
|
|
qaup-postgres:
|
|
image: m.daocloud.io/docker.io/postgis/postgis:17-3.5-alpine
|
|
container_name: qaup-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: qaup
|
|
POSTGRES_USER: qaup
|
|
POSTGRES_PASSWORD: qaup123
|
|
volumes:
|
|
- ./data/postgres:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U qaup"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
|
|
# Redis 缓存服务
|
|
qaup-redis:
|
|
image: m.daocloud.io/docker.io/library/redis:8.0-alpine
|
|
container_name: qaup-redis
|
|
restart: unless-stopped
|
|
command: ["redis-server", "--maxmemory", "256mb", "--maxmemory-policy", "allkeys-lru"]
|
|
volumes:
|
|
- ./data/redis:/data
|
|
ports:
|
|
- "6379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# QAUP 应用服务
|
|
qaup-app:
|
|
image: m.daocloud.io/docker.io/library/eclipse-temurin:21-jre
|
|
container_name: qaup-app
|
|
restart: unless-stopped
|
|
environment:
|
|
SPRING_PROFILES_ACTIVE: prod
|
|
LOG_PATH: /app/logs
|
|
# 数据库连接配置
|
|
DB_HOST: qaup-postgres
|
|
DB_PORT: 5432
|
|
DB_NAME: qaup
|
|
DB_USER: qaup
|
|
DB_PASSWORD: qaup123
|
|
# Flyway配置
|
|
SPRING_FLYWAY_ENABLED: true
|
|
SPRING_FLYWAY_BASELINE_ON_MIGRATE: true
|
|
SPRING_FLYWAY_VALIDATE_ON_MIGRATE: true
|
|
SPRING_FLYWAY_CLEAN_DISABLED: true
|
|
volumes:
|
|
- ./app.jar:/app/app.jar
|
|
- ./config.yml:/app/config.yml
|
|
- ./logs:/app/logs
|
|
- ./backup:/app/backup
|
|
ports:
|
|
- "8080:8080"
|
|
depends_on:
|
|
qaup-postgres:
|
|
condition: service_healthy
|
|
qaup-redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 120s
|
|
command: [
|
|
"sh", "-c",
|
|
"echo 'Waiting for database to be ready...' &&
|
|
sleep 10 &&
|
|
echo 'Starting QAUP application with Flyway migration...' &&
|
|
java -jar /app/app.jar --spring.config.location=/app/config.yml"
|
|
]
|
|
|
|
networks:
|
|
default:
|
|
name: qaup-network |