Dockerfile build doesn't get PORT arg (railway CLI)
My Dockerfile build doesn't get the alleged PORT arg with railway's randomly generated port (i.e.
--build-arg="PORT=7545"
). I'm deploying with the railway CLI.
Project ID: 988c3d59-aff4-487b-8d86-5541ba84fcad
Service ID: b53149d1-7adc-4868-862b-46cedbed17bf
Dockerfile:
Deploy command:
7 Replies
Project ID:
988c3d59-aff4-487b-8d86-5541ba84fcad,b53149d1-7adc-4868-862b-46cedbed17bf
the generated port is only available at run time, there should be no need to use it during build
if your app cant listen on the PORT environment variable during runtime, then just set a PORT service variable to the same port that your app does listen on
ok, in a different service (ID:
108e166f-6409-417f-ab3a-fbf9884561f0
), I tried setting PORT=8080
in my service variables and the port was accessible in both build and deployment, so my app should be listening on 8080
, but I'm getting 503, "Application failed to respond" when I visit the public URL (https://grandiose-friction-production.up.railway.app/)
Here's the Dockerfile. It works perfectly on my local machine:
I checked both apache config files locally and on railway. They have the correct contentsright, as I said the auto generated PORT isn't available during build, but a manually set one would be
make sure you are also listening on host 0.0.0.0 as well
For future readers, I had to specify
0.0.0.0
in the Listen and VirtualHost directives, like this...
Listen 0.0.0.0${PORT}
<VirtualHost 0.0.0.0${PORT}>
@Brody did you mark this as solved yourself? It's only been one day
I was going to mark my message as the solution for future reference#🛂|readme #5
i was confident in what i said being the general solution, so yes i did give this thread a solved tag
huh, ok