fix
This commit is contained in:
@@ -12,6 +12,8 @@ services:
|
||||
- ./data/images:/app/data/images:rw
|
||||
- ./data/reports:/app/data/reports:rw
|
||||
- ./logs:/app/logs:rw
|
||||
# 添加内存转储目录
|
||||
- ./data/dumps:/app/dumps:rw
|
||||
user: "1001:1001" # 指定容器内用户ID,与Dockerfile中的app用户保持一致
|
||||
environment:
|
||||
- SPRING_PROFILES_ACTIVE=prod
|
||||
@@ -31,9 +33,26 @@ services:
|
||||
- SWAGGER_SHOW=false
|
||||
- LOG_ROOT_LEVEL=info
|
||||
- LOG_APP_LEVEL=info
|
||||
# JVM内存优化参数
|
||||
- JAVA_OPTS=-Xms1g -Xmx2g -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/app/dumps/ -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/app/logs/gc.log -XX:+UseContainerSupport -XX:MaxRAMPercentage=80.0 -XX:InitiatingHeapOccupancyPercent=45
|
||||
networks:
|
||||
- proxy
|
||||
restart: unless-stopped
|
||||
# 添加健康检查和资源限制
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9081/point-strategy/actuator/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 3G # 限制容器最大内存使用
|
||||
cpus: '2.0' # 限制CPU使用
|
||||
reservations:
|
||||
memory: 1G # 预留内存
|
||||
cpus: '1.0' # 预留CPU
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
|
||||
Reference in New Issue
Block a user