Well, I've asked about it through the ideas portal, and you mentioned some flexibility

It's ObjectScript, so, it has some flexibility. The only issue is login and password, and using OS-based auth, is a good way to solve this, obviously if OS-level is protected enough.

For instance, you can raise issues just by terminating the process with an exit code higher than 0 with $system.Process.Terminate

irisowner@ca22f45b16b1:~/temp$ cat commands.txt 
_SYSTEM
SYS
 write "hello world"
 write "I'm: ", $username
 if $g(condition,1) Do $system.Process.Terminate(,2)
 write "terminated?"
 halt
irisowner@ca22f45b16b1:~/temp$ cat commands.txt | iris session iris; echo Status: $?

Node: ca22f45b16b1, Instance: IRIS 

Username: 
Password: 
USER>
hello world
USER>
I'm: _SYSTEM
USER>
Status: 2

If you call some InterSystems internal interactive tools. So, most such tools have non-interactive endpoints, so, you can call them directly, and no interactivity is needed.

The hardest part of this is a login and password, and I would recommend configuring OS-based Authorization for %Service_Terminal, so, it will not require login and password. Everything else is quite simple if your script is not supposed to answer questions there.  

cat commands.txt | iris session iris > output.log

and, the content of commands.txt, is something like this

write "hello world"
write "I'm: ", $username
halt

Important to finish the script with halt command, and if you still wish to keep login and password, the first two lines should contain login and password

irisowner@ca22f45b16b1:~/temp$ cat commands.txt 
_SYSTEM
SYS
 write "hello world"
 write "I'm: ", $username
 halt
irisowner@ca22f45b16b1:~/temp$ cat commands.txt | iris session iris 

Node: ca22f45b16b1, Instance: IRIS 

Username: 
Password: 
USER>
hello world
USER>
I'm: _SYSTEM
USER>

And you can pull image for desired platform anywhere, but it tries to download exactly the same layers for not matter of platform

$ docker pull --platform linux/arm64 containers.intersystems.com/intersystems/iris-community:2022.3.0.545.0
2022.3.0.545.0: Pulling from intersystems/iris-community
405f018f9d1d: Already exists
2cbbd12e515b: Pulling fs layer
fe60bfd0c5ab: Pulling fs layer
4ea6673a83ee: Downloading [>                                                  ]  35.91kB/3.369MB
c51907c154c9: Waiting
9a2e0e6b825d: Waiting

$ docker pull --platform linux/amd64 containers.intersystems.com/intersystems/iris-community:2022.3.0.545.0
2022.3.0.545.0: Pulling from intersystems/iris-community
405f018f9d1d: Already exists
2cbbd12e515b: Pulling fs layer
fe60bfd0c5ab: Pulling fs layer
4ea6673a83ee: Pulling fs layer
c51907c154c9: Waiting
9a2e0e6b825d: Waiting

And with arm64 URL, as expected new layers

$ docker pull containers.intersystems.com/intersystems/iris-community-arm64:2022.3.0.545.0                       2022.3.0.545.0: Pulling from intersystems/iris-community-arm64
4a3049d340b7: Pulling fs layer
d37582f21e47: Pulling fs layer
7c3186685c0a: Pulling fs layer
9f6c8eb3bd1d: Waiting
95e5fce820f5: Waiting
789164791b8b: Waiting

That's because they still do not support it that way. Manifest for images "supposed" to support both platforms, returns only one bunch of layers

$ docker manifest inspect containers.intersystems.com/intersystems/iris-community:2022.3.0.545.0                                                               {
    "schemaVersion": 2,
    "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
    "config": {
        "mediaType": "application/vnd.docker.container.image.v1+json",
        "size": 13258,
        "digest": "sha256:09058e9a4d31a2ba75f0549f15f3b770e3da41b2909c713bf07795034a37c83b"
    },
    "layers": [
        {
            "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
            "size": 30423715,
            "digest": "sha256:405f018f9d1d0f351c196b841a7c7f226fb8ea448acd6339a9ed8741600275a2"
        },
        {
            "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
            "size": 277372845,
            "digest": "sha256:2cbbd12e515b4bff4242c44f77538debfef426759723d7fe6910d3b3953cad8c"
        },
        {
            "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
            "size": 435700999,
            "digest": "sha256:fe60bfd0c5abc79baa15ef5a2af58e8ff118cffcfefe4eebd94c319a7cf32d68"
        },
        {
            "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
            "size": 3369232,
            "digest": "sha256:4ea6673a83eec852f096d1ea2717cfda67b1048faa6ff91a45831dd151d64358"
        },
        {
            "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
            "size": 320,
            "digest": "sha256:c51907c154c959f056e0511665961ac2356ff7f828324024f8cd3ad2ed7463cf"
        },
        {
            "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
            "size": 475828,
            "digest": "sha256:9a2e0e6b825d6abeb9ff888a483fe0935d32a4a61923eb466eb2baaccff49896"
        }
    ]
}

While it's expected to be this way when it explicitly mentions both supported platforms

$ docker manifest inspect intersystemsdc/iris-community:preview
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
   "manifests": [
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 2421,
         "digest": "sha256:5bccfba5c1b9877635ac3e1108ed99070c9ba0c7fdd39db32d08d84f367035ca",
         "platform": {
            "architecture": "arm64",
            "os": "linux",
            "variant": "v8"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 2421,
         "digest": "sha256:05f1b866524d0183f3cb6d3830b7b50a601a199a6e8f56e398d04e3226d1c349",
         "platform": {
            "architecture": "amd64",
            "os": "linux"
         }
      }
   ]
}