新增 docker 文件
This commit is contained in:
1 parent
95ed45ffe0
commit
450c6a99cd
8 files changed
+612
No files matched your search
@@ -0,0 +1,87 @@
|
||||
version: '3.8'
|
||||
|
||||
networks:
|
||||
crm_network:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 192.168.100.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
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- ./mysql/data:/var/lib/mysql
|
||||
- ./sql/init.sql:/docker-entrypoint-initdb.d/init.sql: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:
|
||||
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: your-secret-key-change-in-production
|
||||
JWT_EXPIRATION: 86400000
|
||||
|
||||
# 应用配置
|
||||
SERVER_PORT: 8080
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "8080: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:
|
||||
- "80:80"
|
||||
networks:
|
||||
- crm_network
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:80"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
Reference in new issue
Block a user