What is the correct way to run a oneshot that uses bashio in apps that use s6-overlay?

I’m trying to convert an app/addon to use s6-overlay instead of a monolithic run.sh script.

As I understand it, the part of the run.sh that reads config using bashio should be run as a oneshot. However I’m not clear how to make bashio work with a oneshot. To try and figure it out I’ve made a simple Hello,world app that uses bashio to write to the log. I can’t get that working.

Here’s my file structure:

rootfs/
-- etc/
  -- s6-overlay/
    -- s6-rc.d/
      -- my_oneshot/
         type
         up

Type just contains oneshot.
Up is the following:

#!/usr/bin/with-contenv bashio

bashio::log.info "This is a oneshot! I run once and then I'm done."

# Do your one-time task here
touch /tmp/oneshot_was_here

The Dockerfile copies rootfs to /, changes the permissions to a+x for the up file.

When I start the app, it fails with the error: s6-rc-oneshot-run: fatal: unable to exec bashio::log.info: No such file or directory

When I run up inside the docker container it runs successfully.

I think the shebang is not understood when run as a oneshot, so it can’t find bashio::log.info.

What is the correct way to run a oneshot that uses bashio in apps that use s6-overlay?