Fix env_file path for Docker-outside-of-Docker deploy
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 8s

The stack manager runs docker compose inside its own container (talking
to the host daemon over the mounted socket), so env_file paths resolve
against its filesystem, not the host's -- unlike volume bind-mount
sources, which the daemon resolves against the real host. Point env_file
at the stack manager's own data mount instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
dlawler489 2026-09-09 11:25:42 +10:00
parent eaecc41bb1
commit ba070e0ad5

View file

@ -4,12 +4,20 @@ services:
ports: ports:
- "8000:8000" - "8000:8000"
env_file: env_file:
# Absolute path, deliberately outside this repo checkout: the stack # `docker compose` here runs *inside* the stack manager's own
# manager re-clones this directory fresh on every deploy, which would # container (Docker-outside-of-Docker via the mounted host socket),
# silently wipe a .env (or bind-mounted data) placed inside it. # so this path is resolved against ITS filesystem, not the host's --
- /Users/davidlawler/docker/power-compare-data/.env # it must live under the stack manager's own data mount, in a
# directory outside the git checkout that gets wiped/re-cloned each
# deploy. On this host that's /Users/davidlawler/docker/dockhand,
# bind-mounted into the stack manager container as /app/data.
- /app/data/power-compare-persistent/.env
environment: environment:
- DB_PATH=/data/power_compare.db - DB_PATH=/data/power_compare.db
volumes: volumes:
# Bind-mount SOURCE paths, by contrast, are resolved by the real
# Docker daemon against the actual host filesystem (the daemon isn't
# inside the stack manager's container) -- so this one stays a real
# host path, not an /app/data/... one.
- /Users/davidlawler/docker/power-compare-data/data:/data - /Users/davidlawler/docker/power-compare-data/data:/data
restart: unless-stopped restart: unless-stopped