version: '3.8' services: # 后端服务 backend: build: context: ./backend dockerfile: Dockerfile container_name: wecom-backend restart: always ports: - "8888:8888" volumes: - upload_data:/home/ruoyi/uploadPath environment: - SPRING_PROFILES_ACTIVE=prod - TZ=Asia/Shanghai # 数据库连接配置(连接到宿主机的 MySQL 容器) - SPRING_DATASOURCE_URL=jdbc:mysql://host.docker.internal:3316/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - SPRING_DATASOURCE_USERNAME=root - SPRING_DATASOURCE_PASSWORD=jiong1114 # Redis 连接配置(连接到宿主机的 Redis 容器) - SPRING_REDIS_HOST=host.docker.internal - SPRING_REDIS_PORT=6379 - SPRING_REDIS_PASSWORD= extra_hosts: - "host.docker.internal:host-gateway" networks: - wecom-network healthcheck: test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8888/"] interval: 30s timeout: 10s retries: 3 # 前端服务 frontend: build: context: ./frontend dockerfile: Dockerfile container_name: wecom-frontend restart: always ports: - "8889:80" depends_on: - backend networks: - wecom-network # 数据卷 volumes: upload_data: driver: local # 网络 networks: wecom-network: driver: bridge