Verifying where to add cron jobs docker-compose + cron

So you suggest I create a separate script on the host. And then call the script with crontab?

So example:

0   0 * * 0 php -f ????????? nextcloud_optimize.sh

Why not create a crontab and put the commands in directly? Any advantage of the script? For example:

0   0 * * 0 php -f docker exec --user www-data nextcloud php occ files:scan --all
0   0 * * 0 php -f docker exec --user www-data nextcloud php occ files:scan-app-data
0   0 * * 0 php -f docker exec --user www-data nextcloud php occ preview:pre-generate