- docker-compose.yml: 替换 NestJS 后端为 Java (Spring Boot) + MySQL 8.0 - 前端端口 3000:80,后端端口 8080:8080,MySQL 端口 3306:3306 - nginx.conf: proxy_pass 改为 http://backend:8080(Java 内部端口) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
50 lines
1.0 KiB
YAML
50 lines
1.0 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
mysql:
|
|
image: mysql:8.0
|
|
container_name: kg-mysql
|
|
restart: unless-stopped
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: reading_platform_pwd
|
|
MYSQL_DATABASE: reading_platform
|
|
volumes:
|
|
- mysql_data:/var/lib/mysql
|
|
ports:
|
|
- "3306:3306"
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
backend:
|
|
build:
|
|
context: ./reading-platform-java
|
|
container_name: kg-backend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8080:8080"
|
|
environment:
|
|
- SPRING_PROFILES_ACTIVE=prod
|
|
- JWT_SECRET=${JWT_SECRET:-reading-platform-jwt-secret-key-must-be-at-least-256-bits-long}
|
|
volumes:
|
|
- uploads_data:/app/uploads
|
|
depends_on:
|
|
mysql:
|
|
condition: service_healthy
|
|
|
|
frontend:
|
|
build:
|
|
context: ./reading-platform-frontend
|
|
container_name: kg-frontend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3000:80"
|
|
depends_on:
|
|
- backend
|
|
|
|
volumes:
|
|
mysql_data:
|
|
uploads_data:
|