Skip to content

Commit

Permalink
Update Node.js to v22.
Browse files Browse the repository at this point in the history
- The "node14" container is now just named "node" and is based on
  Node.js v22.
- Enabled cache mounts for Apt, Pip, and NPM.
- Upgraded ESLint (and dependencies) to work with Node.js v22.
  • Loading branch information
ZoogieZork committed Dec 12, 2024
1 parent 3f96f21 commit 0b14168
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 37 deletions.
36 changes: 36 additions & 0 deletions backend/Dockerfiles/Dockerfile.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# syntax=docker/dockerfile:1
FROM node:22-bookworm-slim

ARG MAINTAINER
LABEL maintainer=$MAINTAINER

# hadolint ignore=DL3008,DL3016
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
apt-get update && \
apt-get upgrade -y && \
apt-get install python3 python3-pip git -y --no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Upgrade npm for the node_dependencies plugin.
# Install eslint and dependencies for eslint plugin.
WORKDIR /opt/eslint
RUN --mount=type=cache,target=/root/.npm,sharing=locked \
npm install -g [email protected] && \
npm install \
[email protected] \
[email protected] \
[email protected] \
@typescript-eslint/[email protected]

# Provide our own eslint wrapper to set the plugin search directory.
# We assume that eslint will always be called with absolute paths.
RUN printf "#!/bin/sh\ncd /opt/eslint\n"'npx eslint --resolve-plugins-relative-to=/opt/eslint "$@"' > /usr/local/bin/eslint && \
chmod 755 /usr/local/bin/eslint

# Install nodejsscan for the nodejsscan plugin.
# hadolint ignore=DL3013,DL3042
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --break-system-packages --upgrade pip setuptools && \
pip install --break-system-packages \
nodejsscan
26 changes: 0 additions & 26 deletions backend/Dockerfiles/Dockerfile.node14

This file was deleted.

16 changes: 8 additions & 8 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ PYTHON_PKG := ${PREFIX}/python
PYTHON_TAG := ${PYTHON_PKG}:3-latest

NODE_PKG := ${PREFIX}/node
NODE_TAG := ${NODE_PKG}:14-latest
NODE_TAG := ${NODE_PKG}:latest

PHP_PKG := ${PREFIX}/php
PHP_TAG := ${PHP_PKG}:latest
Expand Down Expand Up @@ -449,9 +449,9 @@ dist/docker/python3: Dockerfiles/Dockerfile.python3
touch $@
@echo "${OK}"

dist/docker/node14: Dockerfiles/Dockerfile.node14
dist/docker/node: Dockerfiles/Dockerfile.node
@echo "${INFO}Building $@"
$(DOCKER) build . --pull -t ${NODE_TAG} -f Dockerfiles/Dockerfile.node14 \
$(DOCKER) build . --pull -t ${NODE_TAG} -f Dockerfiles/Dockerfile.node \
${DOCKER_BUILD_EXTRA_ARGS} \
--build-arg MAINTAINER=${MAINTAINER}
mkdir -p ${DIST_DIR}/docker
Expand Down Expand Up @@ -597,7 +597,7 @@ docker-java: docker-bake.hcl Dockerfiles/Dockerfile.java
docker: ## Build all docker images
docker: dist/docker/engine \
dist/docker/python3 \
dist/docker/node14 \
dist/docker/node \
dist/docker/php \
dist/docker/dind \
dist/docker/golang \
Expand Down Expand Up @@ -638,7 +638,7 @@ stage/docker/python3: dist/docker/python3
touch $@
@echo "${OK}"

stage/docker/node14: dist/docker/node14
stage/docker/node: dist/docker/node
@echo "${INFO}Staging $@ in ECR"
mkdir -p ${STAGE_DIR}/docker
aws ecr get-login-password --region=${REGION} | docker login --username AWS --password-stdin ${ECR_URL}
Expand Down Expand Up @@ -739,7 +739,7 @@ stage/docker/swift: dist/docker/swift
docker_push: ## Stage all docker images in ECR
docker_push: stage/docker/engine \
stage/docker/python3 \
stage/docker/node14 \
stage/docker/node \
stage/docker/php \
stage/docker/dind \
stage/docker/golang \
Expand Down Expand Up @@ -1484,7 +1484,7 @@ deploy_python_image:
@echo "${OK}"
.PHONY: deploy_python_image

deploy_node14_image:
deploy_node_image:
@echo "${INFO}Moving staged node image into place"
aws ecr get-login-password --region=${REGION} | docker login --username AWS --password-stdin ${ECR_URL}
docker pull ${ECR_URL}${NODE_TAG}-stage-${LATEST_COMMIT}
Expand Down Expand Up @@ -1596,7 +1596,7 @@ deploy_swift_image:

deploy_images: deploy_engine_image \
deploy_python_image \
deploy_node14_image \
deploy_node_image \
deploy_php_image \
deploy_dind_image \
deploy_golang_image \
Expand Down
2 changes: 1 addition & 1 deletion backend/engine/plugins/eslint/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ESLint Static Scanner",
"type": "static_analysis",
"image": "$ECR/artemis/node:14-latest",
"image": "$ECR/artemis/node:latest",
"runner": "boxed"
}
2 changes: 1 addition & 1 deletion backend/engine/plugins/node_dependencies/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "NPM Audit Scanner",
"type": "vulnerability",
"image": "$ECR/artemis/node:14-latest",
"image": "$ECR/artemis/node:latest",
"runner": "boxed",
"writable": true
}
2 changes: 1 addition & 1 deletion backend/engine/plugins/nodejsscan/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Nodejsscan",
"type": "static_analysis",
"image": "$ECR/artemis/node:14-latest",
"image": "$ECR/artemis/node:latest",
"runner": "boxed"
}

0 comments on commit 0b14168

Please sign in to comment.