fix: port mapping for railway deployment#12
Conversation
📝 WalkthroughWalkthroughThe Dockerfile's CMD instruction converts from exec-form JSON array to shell-form string syntax, enabling environment variable expansion for the Streamlit server port parameter with a default fallback of 8501 instead of a hard-coded value. ChangesDocker Runtime Configuration
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Dockerfile (1)
51-51: ⚡ Quick winAdd
execto the shell-form CMD to prevent signal handling issues withtini.Line 51 uses shell-form
CMD, which Docker converts to["/bin/sh", "-c", "..."]under the exec-formtiniENTRYPOINT. The/bin/shprocess at PID 2 does not forward signals properly to Streamlit. Theexeckeyword fixes this by replacing the shell with Streamlit directly.Suggested change
-CMD streamlit run ui/app.py --server.port=${PORT:-8501} --server.address=0.0.0.0 +CMD ["sh", "-c", "exec streamlit run ui/app.py --server.port=\"${PORT:-8501}\" --server.address=0.0.0.0"]For maximum robustness, consider an entrypoint script instead to avoid the intermediate shell entirely (e.g.,
ENTRYPOINT ["tini", "--"]withCMD ["/app/entrypoint.sh"]that performs variable expansion and execs Streamlit).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile` at line 51, The Dockerfile's shell-form CMD starting with "CMD streamlit run ui/app.py ..." causes /bin/sh (spawned by the tini ENTRYPOINT) to sit between PID 1 and the Streamlit process and not forward signals; update the Dockerfile so the CMD uses exec to replace the shell and directly launch Streamlit (e.g., prepend "exec" to the existing shell-form command) or, better, switch to exec-form JSON CMD/ENTRYPOINT to run Streamlit directly (reference the existing CMD line and the ui/app.py invocation and ensure tini remains as ENTRYPOINT so signals are delivered to the Streamlit process).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Dockerfile`:
- Line 51: The Dockerfile's shell-form CMD starting with "CMD streamlit run
ui/app.py ..." causes /bin/sh (spawned by the tini ENTRYPOINT) to sit between
PID 1 and the Streamlit process and not forward signals; update the Dockerfile
so the CMD uses exec to replace the shell and directly launch Streamlit (e.g.,
prepend "exec" to the existing shell-form command) or, better, switch to
exec-form JSON CMD/ENTRYPOINT to run Streamlit directly (reference the existing
CMD line and the ui/app.py invocation and ensure tini remains as ENTRYPOINT so
signals are delivered to the Streamlit process).
Summary by CodeRabbit