Multiple Process + Dockerfile

So I’ve seen the examples where you can create multiple processes for an app.

  web = "yarn start"
  cron = "supercronic /app/crontab"

Then you can separately scale each of these processes like so: fly scale count web=8 cron=2

In this scenario should I not have a CMD at the end of my dockerfile? That CMD looks like CMD [ "yarn", "run", "start" ]? Should I maybe just do something like CMD ["/bin/sh"] just to fake something to do? What are the best practices?


I believe the default process used is named app, so renaming one web might be troublesome (have you run fly status to see what VM’s total you have? Or perhaps fly m list -a <your-app-name>). It could be that this setup just removes the app process and everything is fine, but just double check.

In any case, the commands defined under [processes] are replacing the CMD used when starting up the VM. So it won’t matter what CMD the Dockerfile defines (as it will get replaced). There isn’t a best practice there necessarily, altho if you DO set a CMD in your Dockerfile, you can have Fly use that CMD (instead of overwrite it) like this:

  web = ""
  cron = "supercronic /app/crontab"

(Just leave the command as an empty string).

Lastly, you will often see ENTRYPOINT used in conjunction with CMD in a Dockerfile - check it out if you’re not sure how that works!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.