How to deploy the Dockerfile w/ specific port #4
-
Recently I want to deploy the https://github.com/Chanzhaoyu/chatgpt-web but meet a problem. Everything works well when I deploy the service, but I can’t visit the web reporting “Service Crashed”. It seems the service is not listening on the port of environment variable $PORT. But how to set the port? I tried to set the port to 3002 but it doesn’t work. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi, the port is not 3002. You should use $PORT (environment variable) to get the right port. For example, assume your project is a Node.js service: This is wrong: app.listen(3002) This is correct: app.listen(process.env.PORT) |
Beta Was this translation helpful? Give feedback.
-
Does it mean I need to manual modify some files in the repo? I am not familiar with the project so it may be hard for me. I tried railway.app and it can deploy without any modifications. I thought Zeabur can do it too. |
Beta Was this translation helpful? Give feedback.
-
You can now deploy services using Dockerfile without modify the code. Zeabur will automatically expose the port which you write in the Dockerfile. |
Beta Was this translation helpful? Give feedback.
You can now deploy services using Dockerfile without modify the code. Zeabur will automatically expose the port which you write in the Dockerfile.