Some checks failed
Deploy / deploy (push) Has been cancelled
Full-stack web application for Telegram management - Frontend: Vue 3 + Vben Admin - Backend: NestJS - Features: User management, group broadcast, statistics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
146 lines
3.7 KiB
YAML
146 lines
3.7 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# 应用服务
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: production
|
|
ports:
|
|
- "${APP_PORT:-3000}:3000"
|
|
environment:
|
|
- NODE_ENV=production
|
|
- PORT=3000
|
|
- DB_HOST=mysql
|
|
- DB_PORT=3306
|
|
- DB_USERNAME=tg_manage
|
|
- DB_PASSWORD=tg_manage_password
|
|
- DB_DATABASE=tg_manage
|
|
- REDIS_HOST=redis
|
|
- REDIS_PORT=6379
|
|
- RABBITMQ_HOST=rabbitmq
|
|
- RABBITMQ_PORT=5672
|
|
- RABBITMQ_USERNAME=admin
|
|
- RABBITMQ_PASSWORD=admin
|
|
- JWT_SECRET=${JWT_SECRET:-your-jwt-secret-key}
|
|
- ANALYTICS_RETENTION_DAYS=90
|
|
depends_on:
|
|
mysql:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
rabbitmq:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./uploads:/app/uploads
|
|
- ./logs:/app/logs
|
|
- ./scripts:/app/scripts
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/health/quick"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
|
|
# MySQL数据库
|
|
mysql:
|
|
image: mysql:8.0
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
|
|
MYSQL_DATABASE: tg_manage
|
|
MYSQL_USER: tg_manage
|
|
MYSQL_PASSWORD: tg_manage_password
|
|
MYSQL_CHARSET: utf8mb4
|
|
MYSQL_COLLATION: utf8mb4_unicode_ci
|
|
ports:
|
|
- "${MYSQL_PORT:-3306}:3306"
|
|
volumes:
|
|
- mysql_data:/var/lib/mysql
|
|
- ./docker/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql
|
|
- ./docker/mysql/my.cnf:/etc/mysql/conf.d/my.cnf
|
|
command: --default-authentication-plugin=mysql_native_password
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$MYSQL_ROOT_PASSWORD"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
# Redis缓存
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "${REDIS_PORT:-6379}:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
- ./docker/redis/redis.conf:/usr/local/etc/redis/redis.conf
|
|
command: redis-server /usr/local/etc/redis/redis.conf
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
# RabbitMQ消息队列
|
|
rabbitmq:
|
|
image: rabbitmq:3.12-management-alpine
|
|
ports:
|
|
- "${RABBITMQ_PORT:-5672}:5672"
|
|
- "${RABBITMQ_MANAGEMENT_PORT:-15672}:15672"
|
|
environment:
|
|
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USERNAME:-admin}
|
|
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD:-admin}
|
|
RABBITMQ_DEFAULT_VHOST: /
|
|
RABBITMQ_ERLANG_COOKIE: ${RABBITMQ_ERLANG_COOKIE:-rabbitmq-cookie}
|
|
volumes:
|
|
- rabbitmq_data:/var/lib/rabbitmq
|
|
- ./docker/rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "rabbitmq-diagnostics", "check_port_connectivity"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 60s
|
|
|
|
# Nginx反向代理 (可选)
|
|
nginx:
|
|
image: nginx:alpine
|
|
ports:
|
|
- "${NGINX_PORT:-80}:80"
|
|
- "${NGINX_SSL_PORT:-443}:443"
|
|
volumes:
|
|
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
|
|
- ./docker/nginx/ssl:/etc/nginx/ssl
|
|
depends_on:
|
|
- app
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
profiles:
|
|
- with-nginx
|
|
|
|
networks:
|
|
app-network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
mysql_data:
|
|
driver: local
|
|
redis_data:
|
|
driver: local
|
|
rabbitmq_data:
|
|
driver: local |