version: '3.8'

services:
  # 应用服务
  cms-api:
    build: .
    container_name: cms-api
    ports:
      - "9200:9200"
    environment:
      - SPRING_PROFILES_ACTIVE=prod
      - JAVA_OPTS=-Xms512m -Xmx1024m
    volumes:
      # 证书挂载卷 - 将宿主机证书目录挂载到容器
      - ./certs:/app/certs:ro
      # 日志挂载卷
      - ./logs:/app/logs
      # 上传文件挂载卷
      - ./uploads:/app/uploads
    networks:
      - cms-network
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9200/actuator/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s

networks:
  cms-network:
    driver: bridge

volumes:
  mysql_data:
    driver: local
  redis_data:
    driver: local
