R
Railway17mo ago
.scapino

Dockerfile exposes port 8000. Railway domain link does not work unless PORT env var is set too

Is this expected behavior? I was told Railway would figure it out, and not require a PORT variable. https://github.com/oatnog/hilopalace/blob/master/Dockerfile https://hilopalace-production.up.railway.app/ says "Application Failed to Respond" Service ID: 520ee4a3-6af7-4fd8-8f16-316cae380f90
GitHub
hilopalace/Dockerfile at master · oatnog/hilopalace
Contribute to oatnog/hilopalace development by creating an account on GitHub.
Solution:
gunicorn listens on $PORT by default, you can remove the bind and 8000 from your CMD
Jump to solution
7 Replies
Percy
Percy17mo ago
Project ID: 520ee4a3-6af7-4fd8-8f16-316cae380f90
Brody
Brody17mo ago
correct you wouldn't be required to set your own PORT variable yourself, on one condition, your app needs to listen on the environment variable PORT, since railway auto generates one for you so yes this is the expected behaviour
.scapino
.scapinoOP17mo ago
Okay! So my Dockerfile is the probelm
Solution
Brody
Brody17mo ago
gunicorn listens on $PORT by default, you can remove the bind and 8000 from your CMD
Brody
Brody17mo ago
you also don't need EXPOSE
.scapino
.scapinoOP17mo ago
Makes sense! Tested and it works. I appreciate your help.
Brody
Brody17mo ago
awesome
Want results from more Discord servers?
Add your server