"syntax error: unexpected word" error when trying to deploy custom Directus Dockerfile

The start.sh file was an alternative way of starting Directus, but I was running into problems with it as well.

#!/bin/sh

set -ex
mkdir -p /snapshots
mkdir -p /data/database
mkdir -p /data/uploads
mkdir -p /data/extensions
chmod -Rf 777 /snapshots
chmod -Rf 777 /data/database
chmod -Rf 777 /data/uploads
chmod -Rf 777 /data/extensions

npx directus bootstrap
npx directus schema apply snapshots/latest.yml --yes &&
npx directus start

Mainly I was getting errors like:

start.sh: line 1: #!/bin/sh: No such file or directory
+ mkdir -p /snapshots
mkdir: can't create directory '/snapshots': Permission denied

I tried changing the shebang to different variations but each one was failing.

This setup was an attempt to use the scripts from my previous post: min_machines_running = 1 not working correctly - #8 by andie That minimal setup seemed to work, but this one does not.