Hopefully, I can clear up some confusion @João Sacramento but if I haven't, please comment down below.
It's the App Service itself which runs the docker command to setup the container where the app will be run, correct?
Yes, that is correct.
Is there no way to control the docker command that's run?
You can use the Startup Command input entry on the General Settings under the App Service > Configuration blade. This command will be passed as the STARTUP_COMMAND
environment variable. See Azure App Service on Linux FAQ / Built-in images for an appropriate startup command.
For example, where is the dockerfile used by Azure App Service stored?
It's pulled from mcr.microsoft.com/azure-app-service/{runtime}
. These are blessed images the guarantee base images are cached and therefore pulled in a timely manner.
I've seen some documentation suggesting adding a 'startup.sh' script which the App Service reads by default. Would this be a viable alternative? Write up the .sh script and add it via FTP? Can it be done via the 'Startup command' field on the Configurations tab?
You can certainly FTP your startup.sh and set it as the startup command for your app service i.e. /home/site/deployments/tools/your-startup-script.sh
Are STARTUP_FILE and STARTUP_COMMAND mutually exclusive?
Not really. You can examine your log stream and notice the platform will echo both (snippet down below). If STARTUP_FILE is configured and found, the platform will adhere to that and run it, but if the startup file is not found, it will fall back to the STARTUP_COMMAND if it is set.
2022-04-25T21:04:12.548539411Z Add private certificates to keystore if exists...
2022-04-25T21:04:12.548973208Z Configuring max heap = 1346 MB
2022-04-25T21:04:12.578821728Z STARTUP_FILE=
2022-04-25T21:04:12.586873280Z STARTUP_COMMAND=java -jar /home/site/wwwroot/app.jar --server.port=80
2022-04-25T21:04:12.586888680Z No STARTUP_FILE available.
2022-04-25T21:04:12.586893280Z Running STARTUP_COMMAND: java -jar /home/site/wwwroot/app.jar --server.port=80
2022-04-25T21:04:12.606642861Z Error: Unable to access jarfile /home/site/wwwroot/app.jar
2022-04-25T21:04:12.606682160Z Finished running startup file 'java -jar /home/site/wwwroot/app.jar --server.port=80'. Exit code: '1'.
2022-04-25T21:04:12.606687860Z Custom startup complete. Now, exiting with exit code '1'
Now on to the nitty gritty, installing dependencies but it seems like you're more than halfway there. The crossing T's and dotted i's will depend on which Java runtime your app is. As long as you have the XML module descriptor file and the necessary jar files, you just need to modify your startup script to install those dependencies via your runtime CLI.