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