Skip to content

Instantly share code, notes, and snippets.

@stevenuray
Created July 5, 2018 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenuray/aad1add60b3b1837e00a1b061c6f7e07 to your computer and use it in GitHub Desktop.
Save stevenuray/aad1add60b3b1837e00a1b061c6f7e07 to your computer and use it in GitHub Desktop.
Dockerlith Lock Script Prepare NPM Volume Function
prepare_npm_volume() {
#Try to get node_modules lock.
lock $LOCK_FILE $LOCK_FD
#Check status of npm libraries now that this container has the lock.
echo "This container has the lock on the npm libraries."
npm_library_status=$(check_npm_libraries)
if [ "$npm_library_status" == "INVALID" ]; then
install_npm_libraries
else
echo "Valid cached npm libraries detected, skipping npm install"
fi
#The lock must be explicitly released here, because the process is expected to continue after this script is done.
unlock $LOCK_FD
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment