by-crm/docker-compose.yml
hanshiyang 6046bc1d24 chore: 更新docker-compose中的网络子网配置
将默认子网从192.168.255.0/24更改为192.244.0.0/24以避免与本地网络冲突
2026-01-27 16:00:09 +08:00

91 lines
2.3 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.

networks:
crm_network:
driver: bridge
ipam:
config:
- subnet: 192.244.0.0/24
services:
# MySQL 数据库
crm-mysql:
image: mysql:8
container_name: crm-mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: MySQL123s56
MYSQL_DATABASE: crm_db
TZ: Asia/Shanghai
command: [
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_unicode_ci',
]
ports:
- "39948:3306"
volumes:
- ./mysql/data:/var/lib/mysql
- ./sql:/docker-entrypoint-initdb.d:ro
networks:
- crm_network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-pMySQL123s56"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# 后端服务
crm-backend:
image: by-crm/crm-backend:2026.01.27
build:
context: ./backend
dockerfile: Dockerfile
container_name: crm-backend
restart: always
depends_on:
crm-mysql:
condition: service_healthy
environment:
# 数据库配置
SPRING_DATASOURCE_URL: jdbc:mysql://crm-mysql:3306/crm_db?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: MySQL123s56
# JWT 配置
JWT_SECRET: by-crm-jwt-secret-key-2024-hs512-requires-at-least-64-bytes-for-secure-signing-please-change-in-production-environment
JWT_EXPIRATION: 86400000
# 应用配置
SERVER_PORT: 8080
TZ: Asia/Shanghai
ports:
- "9948:8080"
volumes:
- ./backend/logs:/app/logs
networks:
- crm_network
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/actuator/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# # 前端服务Nginx
# crm-frontend:
# build:
# context: ./frontend
# dockerfile: Dockerfile
# container_name: crm-frontend
# restart: always
# depends_on:
# - crm-backend
# ports:
# - "9948:80"
# networks:
# - crm_network
# healthcheck:
# test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:80"]
# interval: 30s
# timeout: 5s
# retries: 3