How to transfer a precompiled program into a container?

Suppose you have an existing binary and you want to:

  1. Transfer the binary to a container.
  2. Distribute the binary in the container.

Can this be done?

In general suppose you want to compile your program on your native desktop and then transfer it into a container, how do you do this?

You use the special scratch image

https://hub.docker.com/_/scratch

I have an example project that uses go