-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nodejs] add nodejs docker_ssi test app
- Loading branch information
1 parent
8031afc
commit bc5d067
Showing
11 changed files
with
141 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
export NODEJS_VERSION=$1 | ||
|
||
if [ -f /etc/debian_version ] || [ "$DISTRIBUTION" = "Debian" ] || [ "$DISTRIBUTION" = "Ubuntu" ]; then | ||
OS="Debian" | ||
elif [ -f /etc/redhat-release ] || [ "$DISTRIBUTION" = "RedHat" ] || [ "$DISTRIBUTION" = "CentOS" ] || [ "$DISTRIBUTION" = "Amazon" ] || [ "$DISTRIBUTION" = "Rocky" ] || [ "$DISTRIBUTION" = "AlmaLinux" ]; then | ||
OS="RedHat" | ||
elif [ -f /etc/system-release ] || [ "$DISTRIBUTION" = "Amazon" ]; then | ||
OS="RedHat" | ||
elif [ -f /etc/Eos-release ] || [ "$DISTRIBUTION" = "Arista" ]; then | ||
OS="RedHat" | ||
elif [ -f /etc/SuSE-release ] || [ "$DISTRIBUTION" = "SUSE" ] || [ "$DISTRIBUTION" = "openSUSE" ]; then | ||
OS="SUSE" | ||
elif [ -f /etc/alpine-release ]; then | ||
OS="Alpine" | ||
fi | ||
|
||
if [ "$OS" = "Debian" ]; then | ||
apt-get update | ||
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git curl | ||
elif [ "$OS" = "RedHat" ]; then | ||
yum install -y git curl | ||
else | ||
echo "Unknown OS" | ||
exit 1 | ||
fi | ||
|
||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash | ||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" | ||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" | ||
nvm install ${NODEJS_VERSION} | ||
nvm alias default ${NODEJS_VERSION} | ||
node --version |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ARG BASE_IMAGE | ||
|
||
FROM ${BASE_IMAGE} | ||
WORKDIR /app | ||
COPY lib-injection/build/docker/nodejs/sample-app/ . | ||
ENV HOME /root | ||
EXPOSE 18080 | ||
|
||
# We need pid 1 to be bash and to properly configure nvm | ||
# doing this via `RUN` doesn't seem to work | ||
COPY utils/build/ssi/nodejs/run.sh /app/ | ||
CMD /app/run.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" | ||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" | ||
|
||
node index.js |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
from utils.docker_ssi.docker_ssi_definitions import ( | ||
JavaRuntimeInstallableVersions, | ||
JSRuntimeInstallableVersions, | ||
PHPRuntimeInstallableVersions, | ||
PythonRuntimeInstallableVersions, | ||
) | ||
|
||
|
||
def resolve_runtime_version(library, runtime): | ||
""" For installable runtimes, get the version identifier. ie JAVA_11 """ | ||
"""For installable runtimes, get the version identifier. ie JAVA_11""" | ||
if library == "java": | ||
return JavaRuntimeInstallableVersions.get_version_id(runtime) | ||
elif library == "php": | ||
return PHPRuntimeInstallableVersions.get_version_id(runtime) | ||
elif library == "python": | ||
return PythonRuntimeInstallableVersions.get_version_id(runtime) | ||
elif library == "nodejs": | ||
return JSRuntimeInstallableVersions.get_version_id(runtime) | ||
|
||
raise ValueError(f"Library {library} not supported") |