Update: To see the an example using Astro v2 (with content collections) see this code snippet
This template generates og images at build time using Satori and Astro v1. Check out pages/images/og.png.ts
for source code.
Check out kevinzunigacuellar/web for a complete example