A wrapper script that prepares something and then starts the real program is common, especially as a container entrypoint. The last line decides whether a stop signal ever reaches that program.
Start the program with exec:
#!/bin/sh
mkdir -p /data/cache
chown app:app /data/cache
exec "$@"
exec replaces the shell process with the command instead of starting a child. The program keeps the same PID, so in a container it becomes PID 1 and gets the SIGTERM that docker stop sends. Without exec, the shell receives that signal and the program never hears about it, and Docker kills it hard after the timeout.
"$@" with quotes passes every argument on as it was, also ones with spaces.
I like that this also tidies up the process list: one process instead of a shell waiting for its child.
Anything after the exec line never runs, because the shell is gone. Cleanup with trap ... EXIT also does not fire anymore. If you need work done after the program stops, you cannot use exec and have to forward signals yourself, which is a lot more fiddly.
Further reading: Bash manual: Bourne Shell Builtins (exec), Dockerfile reference: ENTRYPOINT