According to the build service documentation (permalink),
You could also pass additional arguments, for example --command "migrate --production" would run the script specified in Procfile with the --production argument.
However, as far as I can tell from some testing, this only works if the Procfile command just names another command with nothing else, not even any arguments. I tested this with:
print-appended-arguments-per-line: printf >| "$TOOL_DATA_DIR/print-appended-arguments-per-line" '%s\n' print-shell-arguments-per-line: printf >| "$TOOL_DATA_DIR/print-shell-arguments-per-line" '%s\n' "$@" run-true: true run-touch: touch run-touch-hardcoded-and-more: touch /tmp/hardcoded
run-true and run-touch work, but the other three commands fail with quite confusing errors:
$ sudo docker run --rm -it --entrypoint='launcher' tools-harbor.wmcloud.org/tool-lucaswerkmeister-test/tool-lucaswerkmeister-test:latest bash heroku@4702f3006738:/workspace$ run-true; echo $?; echo; echo 0 heroku@4702f3006738:/workspace$ run-touch /tmp/abc heroku@4702f3006738:/workspace$ run-touch-hardcoded-and-more /tmp/def touch /tmp/hardcoded: line 1: touch /tmp/hardcoded: No such file or directory heroku@4702f3006738:/workspace$ ls /tmp; echo; echo abc heroku@4702f3006738:/workspace$ mkdir /tmp/datadir heroku@4702f3006738:/workspace$ export TOOL_DATA_DIR=/tmp/datadir heroku@4702f3006738:/workspace$ print-appended-arguments-per-line heroku@4702f3006738:/workspace$ cat /tmp/datadir/print-appended-arguments-per-line heroku@4702f3006738:/workspace$ print-appended-arguments-per-line arg1 printf >| "$TOOL_DATA_DIR/print-appended-arguments-per-line" '%s\n': line 1: printf >| /tmp/datadir/print-appended-arguments-per-line '%s\n': No such file or directory heroku@4702f3006738:/workspace$ print-shell-arguments-per-line heroku@4702f3006738:/workspace$ cat /tmp/datadir/print-shell-arguments-per-line heroku@4702f3006738:/workspace$ print-shell-arguments-per-line arg1 printf >| "$TOOL_DATA_DIR/print-shell-arguments-per-line" '%s\n' "$@": line 1: printf >| /tmp/datadir/print-shell-arguments-per-line '%s\n' arg1: No such file or directory
If this is the case, then it means that migrate --production as documented on Wikitech also wouldn’t work correctly, because migrate was earlier on the page defined as python3 -m app.migrate, i.e. a command with arguments. (But I haven’t tested this command in particular.)
Waiting on upstream
This is actually something that comes from upstream https://github.com/heroku/procfile-cnb/issues/151, the issue comes from the spec of the launcher process (https://github.com/buildpacks/spec/blob/main/platform.md#launcher), and the non-backwards compatible changes introduced when stopping to wrap every command in a shell.
Waiting on upstream to upgrade to adapt to the new processes (that might still not allow mixing procfile defined arguments and user supplied ones, but we'll see).