Files
server/docker-compose.yml
2025-11-25 17:44:34 +08:00

59 lines
1.9 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
services:
app:
image: archive
container_name: digital-archive-app
ports:
- "9081:9081"
volumes:
# 持久化数据目录 - 设置正确的权限
- ./data/upload:/app/data/upload:rw
- ./data/temp:/app/data/temp:rw
- ./data/unzip:/app/data/unzip:rw
- ./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
- SERVER_PORT=9081
- DB_HOST=database
- DB_PORT=54321
- DB_NAME=enterprise_digital_archives
- DB_USERNAME=system
- DB_PASSWORD=12345678ab
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=Abc123456
- ELASTICSEARCH_HOST=es
- ELASTICSEARCH_PORT=9200
- ELASTICSEARCH_SCHEME=http
- TESS_PATH=/usr/bin/tesseract
- 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