Files
hkuds--deeptutor/docker-compose.dev.yml
Bingxi Zhao (Frank) 083ff4fe3d fix(docker): give the development image the web source it compiles from
`docker compose -f docker-compose.dev.yml up` came up with a dead frontend:
the development stage's supervisor program runs `node scripts/dev.mjs`, and
that path does not exist in the image. The stage builds `FROM production`,
whose ./web is `.next/standalone/`, then cherry-picked three files on top.

Verified against a real standalone build — its root holds exactly
`server.js`, `package.json`, a traced `node_modules` and the dist dir. Every
source file and every config is absent, so `scripts/` was only the first
thing to fail; `tsconfig.json`, `tailwind.config.js`, `postcss.config.js`,
`features/`, `types/` and `proxy.ts` were missing too, and the compose mount
list covers none of them either.

So take the builder's web tree wholesale instead of naming files that keep
drifting as web/ grows top-level entries. `--chown` during the copy keeps
node_modules from being re-layered, and the inherited production build is
cleared so `next dev` starts from an empty cache rather than a half-valid
one.

#906 also reported this as two `[program:frontend]` blocks in one supervisor
config, with the fix being to delete the dev.mjs one. That reading is wrong:
the blocks are in different build stages (`FROM production AS development`),
the production image has exactly one and is unaffected, and deleting the dev
block would have made the development image serve a production build with no
hot reload. The production stage is untouched here.

Not build-verified — no Docker daemon available on this machine.
2026-08-21 16:29:06 +08:00

55 lines
1.8 KiB
YAML

# ============================================
# DeepTutor Docker Compose - Development Override
# ============================================
# Use with: python scripts/docker_compose.py -f docker-compose.yml -f docker-compose.dev.yml up
#
# This override file provides:
# - Hot-reload for both frontend and backend
# - Source code mounting for live editing
# - Development-friendly logging
# ============================================
services:
pocketbase:
volumes:
- ./data/pocketbase:/pb/pb_data
deeptutor:
build:
target: development
volumes:
# Mount backend source code for hot-reload
- ./deeptutor:/app/deeptutor:ro
- ./deeptutor_cli:/app/deeptutor_cli:ro
- ./scripts:/app/scripts:ro
# Mount frontend source for hot-reload. Anything not listed here still
# ships inside the image (see the development stage in Dockerfile) — it
# just will not hot-reload.
- ./web/app:/app/web/app:ro
- ./web/components:/app/web/components:ro
- ./web/features:/app/web/features:ro
- ./web/lib:/app/web/lib:ro
- ./web/hooks:/app/web/hooks:ro
- ./web/context:/app/web/context:ro
- ./web/i18n:/app/web/i18n:ro
- ./web/locales:/app/web/locales:ro
- ./web/public:/app/web/public:ro
# Mount data directories (writable) - output to local ./data
- ./data/user:/app/data/user
- ./data/memory:/app/data/memory
- ./data/knowledge_bases:/app/data/knowledge_bases
# In development, we might want to see logs directly
# Uncomment the following to disable log files and see everything in console
# logging:
# driver: "json-file"
# options:
# max-size: "10m"
# max-file: "3"
networks:
- deeptutor-network