Files
ChatRoom/docker-compose.yml

20 lines
745 B
YAML
Raw Permalink Normal View History

2026-02-04 00:11:24 +08:00
version: '3.8'
2026-02-03 23:45:27 +08:00
services:
app:
2026-02-04 13:06:11 +08:00
build: . # 强制使用当前代码构建镜像
image: zhengdushi/chatroom:latest
2026-02-03 23:45:27 +08:00
container_name: chatroom-app
ports:
- "2779:2779"
environment:
- PORT=2779
2026-02-04 14:52:59 +08:00
# 使用 host.docker.internal 连接宿主机上的 RabbitMQ 和 Redis
- RABBITMQ_URL=amqp://admin:1218Zhengyaqi@host.docker.internal:5672/
- REDIS_ADDR=host.docker.internal:6379
# 移除 depends_on因为依赖的是外部服务
2026-02-04 00:11:24 +08:00
restart: unless-stopped
2026-02-04 14:52:59 +08:00
extra_hosts:
- "host.docker.internal:host-gateway" # 确保 Linux 环境下也能解析(虽然 Windows 通常自带,加上更保险)
2026-02-03 23:45:27 +08:00
2026-02-04 14:52:59 +08:00
# 移除 RabbitMQ 和 Redis 服务定义,直接使用外部容器