Files
java-template/client/docker-compose.template.yml
T
2025-09-06 23:39:04 +08:00

146 lines
3.8 KiB
YAML

# LJWX系统 Docker Compose 配置模板
# 使用统一配置文件 client/config/ljwx-config.yaml
version: '3.8'
networks:
ljwx-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16
services:
# MySQL数据库
ljwx-mysql:
image: ${REGISTRY}/ljwx-mysql:${MYSQL_VERSION}
container_name: ljwx-mysql
restart: unless-stopped
ports:
- "${MYSQL_PORT}:3306"
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USERNAME}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- TZ=Asia/Shanghai
volumes:
- ./data/mysql:/var/lib/mysql
- ./config/mysql/my.cnf:/etc/mysql/conf.d/ljwx.cnf
- ./logs/mysql:/var/log/mysql
- /client/config/ljwx-config.yaml:/app/config/ljwx-config.yaml:ro
networks:
ljwx-network:
ipv4_address: 172.20.0.2
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_PASSWORD}"]
timeout: 10s
retries: 3
interval: 30s
start_period: 30s
# Redis缓存
ljwx-redis:
image: ${REGISTRY}/ljwx-redis:${REDIS_VERSION}
container_name: ljwx-redis
restart: unless-stopped
ports:
- "${REDIS_PORT}:6379"
environment:
- TZ=Asia/Shanghai
volumes:
- ./data/redis:/data
- ./config/redis/redis.conf:/usr/local/etc/redis/redis.conf
- /client/config/ljwx-config.yaml:/app/config/ljwx-config.yaml:ro
networks:
ljwx-network:
ipv4_address: 172.20.0.3
healthcheck:
test: ["CMD", "redis-cli", "ping"]
timeout: 10s
retries: 3
interval: 30s
# Spring Boot后端服务
ljwx-boot:
image: ${REGISTRY}/ljwx-boot:${BOOT_VERSION}
container_name: ljwx-boot
restart: unless-stopped
ports:
- "${BOOT_PORT}:8082"
environment:
- SPRING_PROFILES_ACTIVE=prod
- SERVER_PORT=8082
- SERVICE_NAME=ljwx-boot
- TZ=Asia/Shanghai
volumes:
- ./logs/ljwx-boot:/app/logs
- /client/config/ljwx-config.yaml:/app/config/ljwx-config.yaml:ro
networks:
ljwx-network:
ipv4_address: 172.20.0.4
depends_on:
- ljwx-mysql
- ljwx-redis
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8082/actuator/health"]
timeout: 10s
retries: 3
interval: 30s
start_period: 60s
# Python大屏服务
ljwx-bigscreen:
image: ${REGISTRY}/ljwx-bigscreen:${BIGSCREEN_VERSION}
container_name: ljwx-bigscreen
restart: unless-stopped
ports:
- "${BIGSCREEN_PORT}:8001"
environment:
- FLASK_ENV=production
- SERVER_PORT=8001
- SERVICE_NAME=ljwx-bigscreen
- TZ=Asia/Shanghai
volumes:
- ./logs/ljwx-bigscreen:/app/logs
- /client/config/ljwx-config.yaml:/app/config/ljwx-config.yaml:ro
networks:
ljwx-network:
ipv4_address: 172.20.0.5
depends_on:
- ljwx-mysql
- ljwx-redis
- ljwx-boot
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
timeout: 10s
retries: 3
interval: 30s
start_period: 60s
# Vue.js前端管理界面
ljwx-admin:
image: ${REGISTRY}/ljwx-admin:${ADMIN_VERSION}
container_name: ljwx-admin
restart: unless-stopped
ports:
- "${ADMIN_PORT}:8080"
environment:
- NODE_ENV=production
- SERVER_PORT=8080
- SERVICE_NAME=ljwx-admin
- TZ=Asia/Shanghai
volumes:
- ./logs/nginx:/var/log/nginx
- /client/config/ljwx-config.yaml:/app/config/ljwx-config.yaml:ro
networks:
ljwx-network:
ipv4_address: 172.20.0.6
depends_on:
- ljwx-boot
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
timeout: 10s
retries: 3
interval: 30s
start_period: 30s