azure-dev
azure-dev copied to clipboard
Use Oryx rather than local builds for Node.js and Python apps
I've noticed that I can run the CLI on WSL, so I setup my Windows side to support everything and I immediately noticed two things:
- My API build failed because of CRLF
- The build and deploy took a while compared to running the build in Oryx
This appears to be a conscious decision since SCM_DO_BUILD_DURING_DEPLOY
is disabled. We've spent a lot of effort optimizing Oryx for node/python builds and that should be taken advantage of here as well.
@fiveisprime - Thanks for opening this. I'm trying to better understand how Oryx works and where the work is done. Here's my (very likely incorrect understanding) of what we should be doing (for Node and Python):
- Set
SCM_DO_BUILD_DURING_DEPLOY=true
for app services which run node or python code (we'll keep it tofalse
and useWEBSITE_RUN_FROM_PACKAGE
for .NET) - Don't call
npm run build
or any other build like steps - When deploying, continue to use
az webapp deplyoment source config-zip
to provide a zip file, but don't include artifacts likenode_modules
or a python virtual env in the deployment package, since Oryx will pull these artifacts in as part of the build.
Is that correct? Or do we need to run Oryx on the machine we are deploying from? Do we need to set any other properties in the App Service configuration to use Oryx vs Kudu (which my understanding is now the legacy way to do these builds)?
Oryx is an DevDiv project: https://github.com/microsoft/Oryx It's used in place of Kudu when deploying to App Service Linux.
Those steps are correct. This is also how we're doing deployments in the App Service extension for VS Code (including building .NET locally).
@gadecast (Gabriel Castro) reached out and offered to advise us on this. He is with the Oryx team.
Revisiting this stale issue... I'm not sure about the historical context here, but the current state is that:
For python:
- azd creates its own dictated python venv
- azd installs requirements.txt
- azd does a zipDeploy with the zipped source dir (excluding venv and pycache), with
SCM_DO_BUILD_DURING_DEPLOY=true
for Oryx to build
For node:
- azd runs
npm install
- azd runs
npm run build
- azd does a zipDeploy with the
dist
dir, withSCM_DO_BUILD_DURING_DEPLOY=true
, but artifacts are already built locally.
I believe that some of this were to enable local dev scenarios. But there is opportunity to speed up deploy times for node/python - appservice if we were interested about those efforts (at the cost of less local dev validation).