Skip to content

Commit

Permalink
feat(node): Use nodejs 21
Browse files Browse the repository at this point in the history
  • Loading branch information
heubeck committed Jan 29, 2024
1 parent c95705c commit d9cd803
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env:
NYDUS_VERSION: '2.2.4'
semantic_version: '19.0.5'
java_version: '21'
node_version: '21'
mvn_parameter: '-B -ntp'
image_name: 'ghcr.io/mediamarktsaturn/technolinator'
jobs:
Expand Down Expand Up @@ -62,6 +63,11 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: '${{ env.node_version }}'

- name: Setup Java
uses: actions/setup-java@v4
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env:
DEPSCAN_VERSION: 'v5.2.3'
NYDUS_VERSION: '2.2.4'
java_version: '21'
node_version: '21'
mvn_parameter: '-B -ntp'
cdxgen_branch: ${{ github.event.inputs.cdxgen_branch }}
cdxgen_repo: ${{ github.event.inputs.cdxgen_repo }}
Expand All @@ -28,6 +29,11 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: '${{ env.node_version }}'

- name: Setup Java
uses: actions/setup-java@v4
with:
Expand Down
16 changes: 14 additions & 2 deletions src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ARG DEPSCAN_VERSION
# sdkman provided jdks
ARG JAVA_17_VERSION='17.0.10-tem'
ARG JAVA_21_VERSION='21.0.2-tem'
ARG NODE_VERSION='21'

# location of application binaries and configuration
ENV APP_DIR='/app'
Expand Down Expand Up @@ -45,15 +46,26 @@ RUN \
microdnf update --nodocs -y && \
microdnf reinstall --nodocs -y tzdata && \
ln -fs /usr/share/zoneinfo/UTC /etc/localtime && \
microdnf install --nodocs -y which tar openssl ca-certificates zip unzip findutils fontconfig glibc-langpack-en git nodejs npm golang python3 pip php php-cli php-zip php-json && \
microdnf install --nodocs -y which tar openssl ca-certificates zip unzip findutils fontconfig glibc-langpack-en git golang python3 pip php php-cli php-zip php-json && \
curl -s https://raw.githubusercontent.com/composer/getcomposer.org/main/web/installer | php -- --filename=composer --install-dir=/usr/bin --quiet && \
microdnf clean all -y

ENV NODE_HOME="$APP_DIR/node$NODE_VERSION"

# install nodejs and npm using nvm (node version manager) to get the latest version
RUN \
curl -sf https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash && \
. /root/.nvm/nvm.sh && \
nvm install 21 && \
mv /root/.nvm/versions/node/* $NODE_HOME && \
rm -rf /root/.nvm

# locale options
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

# install cdxgen and relatives
RUN \
export PATH="$PATH:$NODE_HOME/bin" && \
npm install -g @appthreat/atom && \
npm install -g @cyclonedx/cdxgen@"$CDXGEN_VERSION" && \
npm install -g @cyclonedx/cdxgen-plugins-bin@"$CDXGEN_PLUGINS_VERSION"
Expand Down Expand Up @@ -116,7 +128,7 @@ ENV JAVA17_HOME="$SDK_DIR/java/$JAVA_17_VERSION" \
SENSITIVE_ENV_VARS="QUARKUS_GITHUB_APP_APP_ID,QUARKUS_GITHUB_APP_WEBHOOK_SECRET,QUARKUS_GITHUB_APP_PRIVATE_KEY,GITHUB_TOKEN,DTRACK_APIKEY" \
ALLOWED_ENV_SUBSTITUTIONS=""

ENV PATH="$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$GRADLE_HOME/bin"
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$NODE_HOME/bin:$JAVA_HOME/bin:$MAVEN_HOME/bin:$GRADLE_HOME/bin"

ENV JAVA_OPTIONS="-Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="$APP_DIR/quarkus-run.jar"
Expand Down
14 changes: 14 additions & 0 deletions src/test/docker/structure-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ commandTests:
- '.*Missing values for configuration properties.*'
- '.*This configuration is required in prod mode.*'

- name: "Nodejs 21 available"
command: 'node'
args: ["-v"]
expectedOutput:
- 'v21.*'

- name: "NPM 10 available"
command: 'npm'
args: ["-v"]
expectedOutput:
- '10.*'

- name: "Composer installed"
command: 'composer'
args: ["about"]
Expand Down Expand Up @@ -177,6 +189,8 @@ metadataTest:
value: '/app/sdks/maven/current'
- key: GRADLE_HOME
value: '/app/sdks/gradle/current'
- key: NODE_HOME
value: '/app/node21'
- key: MVN_CMD
value: 'mvn'
- key: GRADLE_CMD
Expand Down

0 comments on commit d9cd803

Please sign in to comment.