Two related fixes:
1. Phone (and any LAN client) couldn't reach the web container because
the dev compose mapped 127.0.0.1:WEB_PORT instead of binding all
interfaces. Drop the loopback prefix.
2. Turbopack and NodeNext disagree on extension handling: bot's tsc
needs `.js` extensions in source imports; Turbopack's transpilePackages
path can't resolve those `.js` requests back to `.ts` source. Switch
to consuming the workspace packages via their compiled dist instead:
- packages/db + packages/shared point `main`/`exports` at ./dist/*
- drop transpilePackages from next.config.ts; web picks up the
compiled `.js` files directly
- dev compose command for web builds shared+db before running
`next dev` so dist is fresh when Turbopack starts
- put the `.js` extensions back in packages/db source so NodeNext
compilers (bot's tsc, packages/db's own tsc) are happy
64 lines
1.5 KiB
YAML
64 lines
1.5 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}
|
|
depends_on:
|
|
- tools
|