Bedtime schedule

When is a good age to set a bedtime and routine?

My daughter is going on 4 months and she’s sleeping through the night now, but what time she goes to bed always ranges on when she eats.

Sometimes if I lay her down at 8, she’ll wake back up at midnight to eat then she’ll sleep until like 10am but sometimes she’ll stay asleep at 8 and wake up at like 6am.

How can I set a schedule for her?