Its easier but its not what i want since i will need to deploy other dockerfile in the future, not just wireguard. This one here is just for an example.
What --mount=type=secret will do is place the secret into a file. To get the contents of the file so that you can put the value into an environment variable you will need to use cat. An example:
For sysctl, you will want to create a script that runs the commands, and then create a Dockerfile entrypoint that first runs that script than runs your normal startup command. Example:
Just be aware that Docker (and therefore fly), will concatenate the ENTRYPOINT and CMD and run the result as a single command. That’s why entrypoint scripts tend to have the following:
exec "$@"
What the above does is run the CMD.
One final note: the fly console is very helpful for exploration, particularly when run as follows:
fly console --dockerfile Dockerfile -C bash
What this will do is build the dockerfile, and then create an ephemeral machine loaded with that image and ssh into that image and run bash instead of the ENTRYPOINT and CMD. From there you can explore. Once done, exit and the ephemeral machine will be deployed.