Skip to content

fix: port mapping for railway deployment#12

Merged
varit05 merged 1 commit into
mainfrom
fix/port-mapping-for-railway-deployment
May 5, 2026
Merged

fix: port mapping for railway deployment#12
varit05 merged 1 commit into
mainfrom
fix/port-mapping-for-railway-deployment

Conversation

@varit05

@varit05 varit05 commented May 5, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores
    • Updated container startup configuration to support dynamic port assignment through the PORT environment variable, maintaining a default value of 8501.

@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The 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.

Changes

Docker Runtime Configuration

Layer / File(s) Summary
CMD Instruction
Dockerfile
CMD changes from exec-form ["streamlit","run","ui/app.py","--server.port=8501","--server.address=0.0.0.0"] to shell-form streamlit run ui/app.py --server.port=${PORT:-8501} --server.address=0.0.0.0 to allow PORT environment variable override with 8501 default.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A port once carved in stone so deep,
Now bends its ear to whispers we keep—
The shell expands what JSON could not,
And ${PORT:-8501} claims its new slot!
Flexibility blooms where defaults still stay. 🌱

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating the Dockerfile to use environment variable expansion for port mapping to support Railway deployment configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/port-mapping-for-railway-deployment

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Dockerfile (1)

51-51: ⚡ Quick win

Add exec to the shell-form CMD to prevent signal handling issues with tini.

Line 51 uses shell-form CMD, which Docker converts to ["/bin/sh", "-c", "..."] under the exec-form tini ENTRYPOINT. The /bin/sh process at PID 2 does not forward signals properly to Streamlit. The exec keyword 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", "--"] with CMD ["/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).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e5c225a6-e8d4-40ad-8c50-e84d4427e047

📥 Commits

Reviewing files that changed from the base of the PR and between 3dd75d4 and d760595.

📒 Files selected for processing (1)
  • Dockerfile

@varit05
varit05 merged commit ce56c96 into main May 5, 2026
2 checks passed
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