-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
95 lines (92 loc) · 4.73 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
95 lines (92 loc) · 4.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Live-edit overlay for contributors who want to edit source files on the
# server (or locally) without installing Node/PHP/Composer.
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
#
# What it adds:
# - `frontend` service running `vite build --watch` so .jsx/.css/.blade.php
# edits in ./backend/ are rebuilt to ./backend/public/build/ within ~100ms.
# - Bind mounts on the backend container so PHP/Blade edits are live too
# (no image rebuild needed for application code changes).
#
# Not for production: the image's baked-in `composer install` + `npm run build`
# already produce a self-contained production container. Use this overlay only
# in development / FTP-edit-on-staging-server workflows.
services:
backend:
# Run the SAME production server as base — RoadRunner Octane (image CMD) —
# so the dev/live-edit stack is concurrent and robust (no single-threaded
# `artisan serve` serialization hang, no buggy `php -S` multi-worker 502s).
# Live .jsx editing still works: the `frontend` watcher rebuilds public/build
# (bind-mounted below) and the FlushViteManifest Octane listener (enabled by
# OCTANE_LIVE_RELOAD) re-reads the manifest each request so rebuilds show on
# refresh. PHP/Blade edits need `php artisan octane:reload` (Octane keeps the
# app booted in memory). See CLAUDE.md → "Dev / live editing".
environment:
OCTANE_LIVE_RELOAD: "true"
volumes:
# Composer manifest — bind-mounted (read-write) so `composer require/remove`
# run INSIDE the container write straight through to the host repo (and host
# edits are seen by the container), instead of drifting in the image layer.
# vendor/ is intentionally NOT mounted (stays image-layer for speed), so after
# changing these re-run `composer install` in the container — same pattern as
# `npm ci` for the frontend.
- ./backend/composer.json:/var/www/html/composer.json
- ./backend/composer.lock:/var/www/html/composer.lock
# Live application code (PHP, Blade, JSX source, routes, config).
# Keep storage/ and bootstrap/cache/ as named volumes (defined in the
# base compose file) so they survive across rebuilds.
- ./backend/app:/var/www/html/app
- ./backend/bootstrap/app.php:/var/www/html/bootstrap/app.php
- ./backend/config:/var/www/html/config
- ./backend/database:/var/www/html/database
- ./backend/lang:/var/www/html/lang
- ./backend/modules:/var/www/html/modules
- ./backend/public:/var/www/html/public
- ./backend/resources:/var/www/html/resources
- ./backend/routes:/var/www/html/routes
- ./backend/tests:/var/www/html/tests
# Reverb sees live PHP (broadcast auth + CollectionBroadcaster); restart it
# after editing those (it doesn't hot-reload like Octane).
reverb:
environment:
E2E_CONTROL_ENABLED: "true"
volumes:
- ./backend/app:/var/www/html/app
- ./backend/bootstrap/app.php:/var/www/html/bootstrap/app.php
- ./backend/config:/var/www/html/config
- ./backend/database:/var/www/html/database
- ./backend/routes:/var/www/html/routes
frontend:
image: ghcr.io/mes-open/openmes:${OPENMES_VERSION:-latest}
build:
context: .
dockerfile: backend/Dockerfile
container_name: ${OPENMES_NAME_PREFIX:-openmmes}-frontend
working_dir: /var/www/html
# Bypass the image ENTRYPOINT (docker-entrypoint.sh runs migrations/seeders
# and needs DB creds) — the watcher only builds assets, no DB, no app boot.
entrypoint: ["sh", "-c"]
# The production image strips node_modules; restore them, then watch.
# vite build --watch rebuilds public/build on every .jsx/.css edit (~100ms).
# Single-element list so the whole script reaches `sh -c` as one argument.
command: ["npm ci && npm run watch"]
volumes:
# Source the watcher needs to see.
- ./backend/resources:/var/www/html/resources
- ./backend/lang:/var/www/html/lang:ro
- ./backend/vite.config.js:/var/www/html/vite.config.js:ro
- ./backend/package.json:/var/www/html/package.json:ro
- ./backend/package-lock.json:/var/www/html/package-lock.json:ro
# Workspace UI package — backend/package.json depends on it via
# `file:../packages/ui` (resolves to /var/www/packages/ui from the WORKDIR).
# Required for the runtime `npm ci` here, and lets edits to @openmes/ui
# rebuild live just like backend/resources.
- ./packages:/var/www/packages
# Output the watcher writes — bind-mounted into the backend container too
# so the live HTTP server picks up rebuilt bundles immediately.
- ./backend/public/build:/var/www/html/public/build
restart: unless-stopped
networks:
- openmmes-network