Skip to content

fix(docker): bake server path into entrypoint (ignore runtime APP_NAME) - #100

Merged
f-amine merged 1 commit into
masterfrom
fix/docker-entrypoint-env-collision
Jun 18, 2026
Merged

f-amine merged 1 commit into
masterfrom
fix/docker-entrypoint-env-collision

Conversation

@f-amine

@f-amine f-amine commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Why

All three services crash-looped:
Cannot find module '/app/apps/vibestack-vibestack-azmdyg/server.js'

Dokploy injects its own APP_NAME (= the project name) into every container, and env_file overrides image ENV. The previous CMD sh -c 'exec node apps/$APP_NAME/server.js' therefore read the platform's APP_NAME, not the build-time one → wrong path, same failure for web/marketing/admin.

Fix

Resolve the path at build time: write /app/start.sh from the build ARG and CMD ["/app/start.sh"]. Runtime env can no longer affect it.

Verified locally

Built the web image (APP_NAME=web), ran it with -e APP_NAME=vibestack-vibestack-azmdyg injected (reproducing Dokploy). Container boots: ✓ Ready, /api/health serves (503 only because no DB attached). Without the fix this is the exact crash.

🤖 Generated with Claude Code

All three services crash-looped with
  Cannot find module '/app/apps/vibestack-vibestack-azmdyg/server.js'
Dokploy injects its own APP_NAME (the project name) into every container,
and env_file overrides image ENV, so the prior CMD
`sh -c 'exec node apps/$APP_NAME/server.js'` resolved $APP_NAME to the
project name -> wrong path, identical failure across all apps.

Fix: write the resolved path into /app/start.sh at BUILD time from the
build ARG, and CMD it. Runtime env can no longer influence the path.

Verified: image built with APP_NAME=web boots cleanly even when run with
-e APP_NAME=vibestack-vibestack-azmdyg injected (Next ready, health serves).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@f-amine
f-amine merged commit 24b10e7 into master Jun 18, 2026
3 checks passed
@f-amine
f-amine deleted the fix/docker-entrypoint-env-collision branch June 18, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant