-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint
executable file
·46 lines (38 loc) · 1.16 KB
/
entrypoint
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/ash
# Hard core mode
## -e Exit immediately if a command exits with a non-zero status.
## -u Treat unset variables as an error.
## -o pipefail The return value of a pipeline is the status of the last command
## to exit with a non-zero status, or zero if no command exited
## with a non-zero status.
set -eu -o pipefail
# ANSI escape codes
ESC="\x1b"
CSI="${ESC}["
RST="${CSI}0m"
RED="${CSI}31m"
GRE="${CSI}32m"
BLU="${CSI}34m"
# Service name
SERVICE_NAME="${GRE}NodeJS${RST}"
# Service version
SERVICE_NAME="${SERVICE_NAME} (${BLU}$(node --version)${RST})"
# Debugging information
if [ "${DOCKER_DEBUG}" != "" ]; then
printf "debuging %b\n\n" "${SERVICE_NAME}"
# Print environment variables
printf "NJCLITOOL %b\n" "${NJCLITOOL}"
printf "NJRUNCMD %b\n" "${NJRUNCMD}"
printf "DOCKER_DEBUG %b\n\n" "${DOCKER_DEBUG}"
fi
# Initialize the service only if not already initialized
if [ ! -d "${PWD}/node_modules" ]; then
npm update
npm upgrade
npm install --global "${NJCLITOOL}"
else
printf "%b %b, Skiping initialization\n" "${SERVICE_NAME}" "${GRE}found${RST}"
fi
printf "%b launched\n" "${SERVICE_NAME}"
# Execute the service
exec ${NJRUNCMD}