a year ago
Hey! I am currently building a personal project, and I have successfully dockerized my Go server that serves my static build of a React frontend.
Running: docker build --no-cache -t repeticode .
followed bydocker run -p 8080:8080 repeticode works and serves my server locally, whilst displaying my frontend. However, I keep on getting a 502 Bad Gateway error when I try to deploy on Railway using my Dockerfile!
Here is my Github repo: https://github.com/emoral435/RepetiCode
The main files of concern are my Dockerfile, and my main.go files.
My build logs are completely fine, and here are my deploy logs:
`Starting Container
time=2025-03-14T00:54:26.054Z level=INFO msg="checking static files" path=./frontend/dist/
time=2025-03-14T00:54:26.054Z level=INFO msg="initializing server" port=8080 static_path=./frontend/dist/
time=2025-03-14T00:54:26.054Z level=INFO msg="server started" addr=0.0.0.0:8080
What could be the issue? If anything else needs clarifying, let me know! Hopefully I can get this resolved, as I truly don't want to try deploying anywhere else, haha!
3 Replies
a year ago
Hello,
Please see our docs on this topic -
https://docs.railway.com/reference/errors/application-failed-to-respond
Status changed to Awaiting User Response Railway • 12 months ago
a year ago
Thank you so much! This was indeed the fix - I had trouble finding where the settings where previously, but apparently Railway was expecting my app to be listening to port 3000 instead of 8080, haha. Again, thanks!
Status changed to Awaiting Railway Response Railway • 12 months ago
Status changed to Awaiting User Response Railway • 12 months ago
Status changed to Solved brody • 12 months ago