Files
weibo_signin/docker-compose.yml

86 lines
2.1 KiB
YAML
Raw Normal View History

2026-03-09 14:05:00 +08:00
version: '3.8'
2026-03-17 10:29:22 +08:00
# ============================================================
# Weibo-HotSign Docker Compose
# 使用方式:
# 1. 填写下方 x-db-env 中的 MySQL/Redis 密码
# 2. docker-compose up -d --build
# 3. 访问 http://localhost:5000
# ============================================================
2026-03-09 14:05:00 +08:00
2026-03-17 10:29:22 +08:00
# 共享环境变量(避免重复)
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"
2026-03-09 14:05:00 +08:00
2026-03-17 10:29:22 +08:00
services:
# 认证服务 (端口 8001)
2026-03-09 14:05:00 +08:00
auth-service:
build:
context: ./backend
dockerfile: Dockerfile
2026-03-17 10:29:22 +08:00
target: auth-service
container_name: weibo-auth
restart: unless-stopped
2026-03-09 14:05:00 +08:00
ports:
2026-03-17 10:29:22 +08:00
- "8001:8001"
2026-03-09 14:05:00 +08:00
environment:
2026-03-17 10:29:22 +08:00
<<: *db-env
extra_hosts:
- "host.docker.internal:host-gateway"
2026-03-09 14:05:00 +08:00
networks:
2026-03-17 10:29:22 +08:00
- weibo-net
2026-03-09 14:05:00 +08:00
2026-03-17 10:29:22 +08:00
# API 服务 (端口 8000)
api-service:
2026-03-09 14:05:00 +08:00
build:
context: ./backend
dockerfile: Dockerfile
2026-03-17 10:29:22 +08:00
target: api-service
container_name: weibo-api
restart: unless-stopped
2026-03-09 14:05:00 +08:00
ports:
2026-03-17 10:29:22 +08:00
- "8000:8000"
2026-03-09 14:05:00 +08:00
environment:
2026-03-17 10:29:22 +08:00
<<: *db-env
extra_hosts:
- "host.docker.internal:host-gateway"
2026-03-09 14:05:00 +08:00
depends_on:
2026-03-17 10:29:22 +08:00
- auth-service
2026-03-09 14:05:00 +08:00
networks:
2026-03-17 10:29:22 +08:00
- weibo-net
2026-03-09 14:05:00 +08:00
2026-03-17 10:29:22 +08:00
# Flask 前端 (端口 5000)
frontend:
2026-03-09 14:05:00 +08:00
build:
2026-03-17 10:29:22 +08:00
context: ./frontend
2026-03-09 14:05:00 +08:00
dockerfile: Dockerfile
2026-03-17 10:29:22 +08:00
container_name: weibo-frontend
restart: unless-stopped
2026-03-09 14:05:00 +08:00
ports:
2026-03-17 10:29:22 +08:00
- "5000:5000"
2026-03-09 14:05:00 +08:00
environment:
2026-03-17 10:29:22 +08:00
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
2026-03-09 14:05:00 +08:00
networks:
2026-03-17 10:29:22 +08:00
- weibo-net
2026-03-09 14:05:00 +08:00
networks:
2026-03-17 10:29:22 +08:00
weibo-net:
2026-03-09 14:05:00 +08:00
driver: bridge