feat: 项目初始化及当前全部内容提交
This commit is contained in:
@@ -0,0 +1,233 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# MySQL数据库
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
container_name: emotion-mysql
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-123456}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-emotion_museum}
|
||||
MYSQL_USER: ${MYSQL_USERNAME:-emotion}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-emotion123}
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
ports:
|
||||
- "${MYSQL_PORT:-3306}:3306"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- ./database/mysql_emotion_museum_final.sql:/docker-entrypoint-initdb.d/01-init.sql
|
||||
- ./deploy/mysql/conf.d:/etc/mysql/conf.d
|
||||
command: >
|
||||
--default-authentication-plugin=mysql_native_password
|
||||
--character-set-server=utf8mb4
|
||||
--collation-server=utf8mb4_unicode_ci
|
||||
--default-time-zone='+8:00'
|
||||
--max-connections=1000
|
||||
--max-allowed-packet=64M
|
||||
networks:
|
||||
- emotion-network
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-123456}"]
|
||||
timeout: 20s
|
||||
retries: 10
|
||||
|
||||
# Redis缓存
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: emotion-redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${REDIS_PORT:-6379}:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
- ./deploy/redis/redis.conf:/usr/local/etc/redis/redis.conf
|
||||
command: redis-server /usr/local/etc/redis/redis.conf
|
||||
networks:
|
||||
- emotion-network
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
# 网关服务
|
||||
gateway:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: gateway-Dockerfile
|
||||
args:
|
||||
JAR_FILE: emotion-gateway-1.0.0.jar
|
||||
CONFIG_FILE: config/gateway-test.yml
|
||||
container_name: emotion-gateway
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${GATEWAY_PORT:-9000}:9000"
|
||||
environment:
|
||||
SPRING_PROFILES_ACTIVE: test
|
||||
NACOS_SERVER_ADDR: ${NACOS_SERVER_ADDR:-localhost:8848}
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_PORT: 3306
|
||||
MYSQL_USERNAME: ${MYSQL_USERNAME:-emotion}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-emotion123}
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
SERVER_IP: ${SERVER_IP:-localhost}
|
||||
JWT_SECRET: ${JWT_SECRET:-emotion-museum-test-secret-key-2025}
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- emotion-network
|
||||
volumes:
|
||||
- ${LOG_PATH:-./logs}:/data/logs/emotion-museum
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9000/actuator/health"]
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
|
||||
# 用户服务
|
||||
user-service:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: user-Dockerfile
|
||||
args:
|
||||
JAR_FILE: emotion-user-1.0.0.jar
|
||||
CONFIG_FILE: config/application-test.yml
|
||||
container_name: emotion-user
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${USER_SERVICE_PORT:-9001}:9001"
|
||||
environment:
|
||||
SPRING_PROFILES_ACTIVE: test
|
||||
NACOS_SERVER_ADDR: ${NACOS_SERVER_ADDR:-localhost:8848}
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_PORT: 3306
|
||||
MYSQL_USERNAME: ${MYSQL_USERNAME:-emotion}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-emotion123}
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
SERVER_IP: ${SERVER_IP:-localhost}
|
||||
JWT_SECRET: ${JWT_SECRET:-emotion-museum-test-secret-key-2025}
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- emotion-network
|
||||
volumes:
|
||||
- ${LOG_PATH:-./logs}:/data/logs/emotion-museum
|
||||
- ${UPLOAD_PATH:-./uploads}:/data/uploads/emotion-museum
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9001/actuator/health"]
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
|
||||
# AI服务
|
||||
ai-service:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: ai-Dockerfile
|
||||
args:
|
||||
JAR_FILE: emotion-ai-1.0.0.jar
|
||||
CONFIG_FILE: config/ai-test.yml
|
||||
container_name: emotion-ai
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${AI_SERVICE_PORT:-9002}:9002"
|
||||
environment:
|
||||
SPRING_PROFILES_ACTIVE: test
|
||||
NACOS_SERVER_ADDR: ${NACOS_SERVER_ADDR:-localhost:8848}
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_PORT: 3306
|
||||
MYSQL_USERNAME: ${MYSQL_USERNAME:-emotion}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-emotion123}
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
SERVER_IP: ${SERVER_IP:-localhost}
|
||||
COZE_API_TOKEN: ${COZE_API_TOKEN:-your-coze-api-token}
|
||||
JWT_SECRET: ${JWT_SECRET:-emotion-museum-test-secret-key-2025}
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- emotion-network
|
||||
volumes:
|
||||
- ${LOG_PATH:-./logs}:/data/logs/emotion-museum
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9002/actuator/health"]
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
|
||||
# 前端应用
|
||||
web:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
NODE_ENV: test
|
||||
VUE_APP_API_BASE_URL: http://${SERVER_IP:-localhost}:${GATEWAY_PORT:-9000}
|
||||
VUE_APP_ENVIRONMENT: test
|
||||
container_name: emotion-web
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${WEB_PORT:-3000}:80"
|
||||
environment:
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
depends_on:
|
||||
gateway:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- emotion-network
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:80/"]
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
||||
# Nginx反向代理
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: emotion-nginx
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${NGINX_PORT:-80}:80"
|
||||
volumes:
|
||||
- ./deploy/nginx/conf.d:/etc/nginx/conf.d
|
||||
- nginx_logs:/var/log/nginx
|
||||
environment:
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
depends_on:
|
||||
- web
|
||||
- gateway
|
||||
networks:
|
||||
- emotion-network
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:80/health"]
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
nginx_logs:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
emotion-network:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: ${SUBNET:-172.20.0.0/16}
|
||||
gateway: ${GATEWAY_IP:-172.20.0.1}
|
||||
Reference in New Issue
Block a user