forked from tucker01/jenkins-nvm-keytar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·28 lines (22 loc) · 804 Bytes
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
#########################################################
# Setup ENTRYPOINT script when running the image: #
# - Installs the desired version of node js for root #
# - Installs the desired version of node js for jenkins #
#########################################################
# Exit if any commands fail
set -e
# Extract Node.js version from env var
VERSION=$NODE_JS_NVM_VERSION
if [ -z "$VERSION" ]; then
echo "No version specified"
else
# Execute the node installation script
echo "Installing Node.js version $VERSION for current user..."
install_node.sh $VERSION
# Execute the script for user jenkins
echo "Installing Node.js version $VERSION for jenkins user..."
su -c "install_node.sh $VERSION" - jenkins
fi
# Execute passed cmd
exec "$@"