switch.sh 依赖 reading-platform-backend:latest 和 reading-platform-frontend:latest 镜像名来启动容器, 不加 image 字段时 docker compose build 会生成错误的镜像名 导致 CI/CD 部署后实际运行的仍是旧镜像 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
995 B
YAML
35 lines
995 B
YAML
version: '3.8'
|
|
|
|
services:
|
|
backend:
|
|
image: reading-platform-backend:latest
|
|
build:
|
|
context: ./reading-platform-java
|
|
container_name: kg-backend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8080:8080"
|
|
environment:
|
|
- SPRING_PROFILES_ACTIVE=prod
|
|
- SPRING_DATASOURCE_URL=jdbc:mysql://8.148.151.56:3306/reading_platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
|
- SPRING_DATASOURCE_USERNAME=root
|
|
- SPRING_DATASOURCE_PASSWORD=reading_platform_pwd
|
|
- SPRING_FLYWAY_ENABLED=false
|
|
- JWT_SECRET=${JWT_SECRET:-reading-platform-jwt-secret-key-must-be-at-least-256-bits-long}
|
|
volumes:
|
|
- uploads_data:/app/uploads
|
|
|
|
frontend:
|
|
image: reading-platform-frontend:latest
|
|
build:
|
|
context: ./reading-platform-frontend
|
|
container_name: kg-frontend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3000:80"
|
|
depends_on:
|
|
- backend
|
|
|
|
volumes:
|
|
uploads_data:
|