Files
weibo_signin/docker-compose.yml

99 lines
2.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================
# Weibo-HotSign Docker Compose
# 使用方式:
# 1. 填写下方 x-db-env 中的 MySQL/Redis 密码
# 2. docker-compose up -d --build
# 3. 访问 http://服务器IP:5000
# ============================================================
# 共享环境变量(避免重复)
# MySQL 地址用 1Panel 容器名Redis 如果也是容器就用容器名
x-db-env: &db-env
DATABASE_URL: "mysql+aiomysql://weibo:123456@1Panel-mysql-lvRT:3306/weibo_hotsign?charset=utf8mb4"
REDIS_URL: "redis://:123456@1Panel-redis-YY6z: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:
- 1panel-network
# 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:
- 1panel-network
# 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://weibo-api:8000"
AUTH_BASE_URL: "http://weibo-auth:8001"
SESSION_TYPE: "filesystem"
depends_on:
- api-service
- auth-service
networks:
- 1panel-network
# 定时任务调度器 (Celery Worker + Beat)
task-scheduler:
build:
context: ./backend
dockerfile: task_scheduler/Dockerfile
container_name: weibo-scheduler
restart: unless-stopped
environment:
<<: *db-env
depends_on:
- api-service
networks:
- 1panel-network
networks:
1panel-network:
external: true