Cache node_modules for each hash of package-lock.json, Node version and NPM version
/home/site/deploy_cache/node_modules-${md5 hash_of_package_lock.json}-node${NODE_VERSION}-npm${NPM_VERSION}.tar.gz
graph TB;
Start([Start]);
Start-->CheckLockVersion{if package-lock.json changed};
CheckLockVersion-->|True| DefaultInstall;
CheckLockVersion-->|False| CheckCachedModule;
CheckCachedModule{if cached module found};
CheckCachedModule-->|True| CopyCache;
CheckCachedModule-->|False| DefaultInstall;
DefaultInstall[npm install]-->DefaultBuild;
DefaultBuild[npm build];
DefaultBuild-->OryxCopyNodeModules[Oryx make node_modules.tar.gz];
OryxCopyNodeModules-->CreateCache;
CreateCache[cp ./node_modules.tar.gz $cached_node_modules_archive]-->End;
CopyCache[tar -xzf $cached_node_modules_archive -C ./node_modules]-->CacheBuild;
CacheBuild[npm build];
CacheBuild-->RemoveNodeModule[rm -rf ./node_modules]-->End;
End([End]);
Oryx/nodejs.md at main · microsoft/Oryx
[
{
"name": "CUSTOM_BUILD_COMMAND",
"value": "sh azureappservice_custombuild.sh",
"slotSetting": false
},
{
"name": "POST_BUILD_COMMAND",
"value": "sh azureappservice_postbuild.sh",
"slotSetting": false
},
{
"name": "PRE_BUILD_COMMAND",
"value": "sh azureappservice_prebuild.sh",
"slotSetting": false
}
]