fix(docker): stop injecting .env as real env vars (test isolation)
env_file: .env exported the dev DB/cache config as real container env vars, which overrode phpunit's forced test env — so the Pest suite ran RefreshDatabase against the dev MariaDB and wiped it on every run. Laravel already reads .env from the bind mount; only vite needs VITE_HMR_HOST/VITE_PORT at process level, now injected explicitly. Tests now use sqlite :memory: and never touch dev data. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>feat/portal-design
parent
254a7d46a0
commit
2b08b072fe
|
|
@ -17,7 +17,12 @@ services:
|
|||
ports:
|
||||
- "${APP_PORT:-80}:80"
|
||||
- "${VITE_PORT:-5173}:5173"
|
||||
env_file: .env
|
||||
# Laravel reads .env from the bind mount. Do NOT inject it as real env vars
|
||||
# (env_file): that would override the test env (phpunit force) and let the
|
||||
# test suite run against the dev DB. Only vite needs these at process level.
|
||||
environment:
|
||||
VITE_HMR_HOST: ${VITE_HMR_HOST:-localhost}
|
||||
VITE_PORT: ${VITE_PORT:-5173}
|
||||
depends_on:
|
||||
mariadb:
|
||||
condition: service_healthy
|
||||
|
|
@ -32,7 +37,6 @@ services:
|
|||
- .:/var/www/html
|
||||
ports:
|
||||
- "${REVERB_HOST_PORT:-8080}:8080"
|
||||
env_file: .env
|
||||
depends_on:
|
||||
- app
|
||||
- redis
|
||||
|
|
@ -43,7 +47,6 @@ services:
|
|||
command: php artisan queue:work redis --tries=3 --timeout=90
|
||||
volumes:
|
||||
- .:/var/www/html
|
||||
env_file: .env
|
||||
depends_on:
|
||||
- app
|
||||
- redis
|
||||
|
|
@ -55,7 +58,6 @@ services:
|
|||
command: php artisan schedule:work
|
||||
volumes:
|
||||
- .:/var/www/html
|
||||
env_file: .env
|
||||
depends_on:
|
||||
- app
|
||||
- redis
|
||||
|
|
|
|||
Loading…
Reference in New Issue