Files
weibo_signin/docker-compose.yml
2026-03-17 10:29:22 +08:00

86 lines
2.1 KiB
YAML

version: '3.8'
# ============================================================
# Weibo-HotSign Docker Compose
# 使用方式:
# 1. 填写下方 x-db-env 中的 MySQL/Redis 密码
# 2. docker-compose up -d --build
# 3. 访问 http://localhost:5000
# ============================================================
# 共享环境变量(避免重复)
x-db-env: &db-env
DATABASE_URL: "mysql+aiomysql://weibo:123456@host.docker.internal:3306/weibo_hotsign?charset=utf8mb4"
REDIS_URL: "redis://:123456@host.docker.internal:6379/0"
USE_REDIS: "true"
JWT_SECRET_KEY: "change-me-to-a-random-string-in-production"
JWT_ALGORITHM: "HS256"
JWT_EXPIRATION_HOURS: "24"
COOKIE_ENCRYPTION_KEY: "change-me-to-a-32byte-key-prod!"
WX_APPID: ""
WX_SECRET: ""
ENVIRONMENT: "production"
services:
# 认证服务 (端口 8001)
auth-service:
build:
context: ./backend
dockerfile: Dockerfile
target: auth-service
container_name: weibo-auth
restart: unless-stopped
ports:
- "8001:8001"
environment:
<<: *db-env
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- weibo-net
# API 服务 (端口 8000)
api-service:
build:
context: ./backend
dockerfile: Dockerfile
target: api-service
container_name: weibo-api
restart: unless-stopped
ports:
- "8000:8000"
environment:
<<: *db-env
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
- auth-service
networks:
- weibo-net
# Flask 前端 (端口 5000)
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: weibo-frontend
restart: unless-stopped
ports:
- "5000:5000"
environment:
FLASK_ENV: "production"
FLASK_DEBUG: "False"
SECRET_KEY: "change-me-flask-secret-key"
API_BASE_URL: "http://api-service:8000"
AUTH_BASE_URL: "http://auth-service:8001"
SESSION_TYPE: "filesystem"
depends_on:
- api-service
- auth-service
networks:
- weibo-net
networks:
weibo-net:
driver: bridge