cm_whatsapp_bot_v1/docker-compose.dev.yml
yiekheng 7ab51335a4 fix(compose): pass AUTH_SECRET + OPERATOR_TOKEN_VERSION to web container
The web service container only inherited NODE_ENV/DATABASE_URL/DATA_DIR/
MEDIA_DIR/WEB_PORT, so AUTH_SECRET (set in .env.development) was never
visible inside the container. Login bailed out with 'Server is not
configured for sign-in.' loginAction needs both keys to issue cookies,
and OPERATOR_TOKEN_VERSION defaults to 1 (the env-bump session
invalidator).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 18:17:22 +08:00

66 lines
1.6 KiB
YAML

services:
tools:
image: cm-whatsapp-tools:dev
build:
context: .
dockerfile: docker/tools.Dockerfile
bot:
build:
context: .
dockerfile: docker/bot.Dockerfile
target: build
image: cm-whatsapp-bot:dev
container_name: cmbot-bot
user: "${HOST_UID:-1000}:${HOST_GID:-1000}"
working_dir: /app
command: ["pnpm", "--filter", "@cmbot/bot", "dev"]
restart: unless-stopped
volumes:
- .:/app
- ./dev-data:/data
ports:
- "127.0.0.1:8081:8081"
environment:
NODE_ENV: development
DATABASE_URL: ${DATABASE_URL}
DATA_DIR: ${DATA_DIR}
SESSIONS_DIR: ${SESSIONS_DIR}
MEDIA_DIR: ${MEDIA_DIR}
BOT_HEALTH_PORT: ${BOT_HEALTH_PORT}
BOT_LOG_LEVEL: ${BOT_LOG_LEVEL}
networks:
- cmbot
depends_on:
- tools
web:
build:
context: .
dockerfile: docker/web.Dockerfile
target: build
image: cm-whatsapp-web:dev
container_name: cmbot-web
user: "${HOST_UID:-1000}:${HOST_GID:-1000}"
working_dir: /app
command:
- sh
- -c
- "pnpm --filter @cmbot/shared build && pnpm --filter @cmbot/db build && pnpm --filter @cmbot/web dev"
restart: unless-stopped
volumes:
- .:/app
- ./dev-data:/data
ports:
- "${WEB_PORT}:3000"
environment:
NODE_ENV: development
DATABASE_URL: ${DATABASE_URL}
DATA_DIR: ${DATA_DIR}
MEDIA_DIR: ${MEDIA_DIR}
WEB_PORT: ${WEB_PORT}
AUTH_SECRET: ${AUTH_SECRET}
OPERATOR_TOKEN_VERSION: ${OPERATOR_TOKEN_VERSION:-1}
depends_on:
- tools