Open tvriesde opened 1 month ago
@weikanglim can you take a look and clarify?
@tvriesde Thanks a lot for mentioning this. You are indeed correct that SCM_DO_BUILD_DURING_DEPLOYMENT
is needed in azd
today for nom-based apps so that app service would run a full build remotely (npm install
and npm build
in this case) while being deployed.
Do you know what you ended up deciding on? Did setting SCM_DO_BUILD_DURING_DEPLOYMENT=true
satisfy your needs, or would you have preferred to upload a fully built application?
At first glance, a nice thing to do here is for azd
to probe the app service settings and act accordingly, since specifying SCM_DO_BUILD_DURING_DEPLOYMENT=false
and not including node_modules
wouldn't quite work. Alternatively, we could consider ignore options for deployment targets.
I chose to set SCM_DO_BUILD_DURING_DEPLOYMENT=true.
In the end this works for me. But I ran into this because initially the app did not work due to the modules not being present at the server.
When following the guidance from Microsoft. https://learn.microsoft.com/en-us/azure/app-service/configure-language-nodejs?pivots=platform-linux There is no mention of SCM_DO_BUILD_DURING_DEPLOYMENT. So AZD not including the node_modules, caused my app deployment to fail.
Even though I follow the article https://learn.microsoft.com/en-us/azure/app-service/configure-language-nodejs?pivots=platform-linux.
So there is a bit of friction, that can be improved by: Appending the documentation, or adapting the tool a bit, like you mention @weikanglim
When it comes down to the solution you present. This would have helped me indeed. Or presenting it as an option, so that I make an "ïnfromed" decision. Because zipping the node_modules might not always be the preferred scenario.
The downside of your solution is that I might not have gone down the route of SCM_DO_BUILD_DURING_DEPLOYMENT, which, could be the "preferred" option for certain use cases. There could be a difference in total deployment time for both scenario's, especially for larger projects.
In framework_service_npm.go node_modules seem to be excluded as part of the zip deployment.
This requires App Service deployments to have SCM_DO_BUILD_DURING_DEPLOYMENT=true for app services.
It would be helpful if this is mentioned in the azd documentation. (maybe i missed it)
and/or Node_module exclusion can be set as an option for azd deploy. So that developers can choose if they want to include node_modules in zip deployment or not.