Created
July 5, 2018 21:22
-
-
Save stevenuray/aad1add60b3b1837e00a1b061c6f7e07 to your computer and use it in GitHub Desktop.
Dockerlith Lock Script Prepare NPM Volume Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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