DEV Community

Discussion on: Create a Restful API with Golang from scratch

Collapse
 
pacheco profile image
Thiago Pacheco

Hi @dryluigi, thanks for the feedback!
The command to run is defined in the ENTRYPOINT line.
In the dockerfile we can specify how to run the app through either of these 2 options: CMD or ENTRYPOINT.
The ENTRYPOINT one is prefered if you have an specific built entrypoint to run the app, which in our case we have the air to run on dev mode and the todo built file if we want to run a production version. This option is good for apps that generate a build file, like Golang or Java apps for example.
The CMD is used when you want to define a default command that can be overridden or extended by whoever wants to use this file. In Node.js applications for example you might have a: CMD ['npm', 'start'].