Skip to content

Commit

Permalink
🌱 Update project to use nodejs 20, npm >=10.5.2
Browse files Browse the repository at this point in the history
Upgrade the project to use nodejs-20 in the `Dockerfile`,
and package.json engine block.  More specific entries
for `.dockerignore` will help keep the `COPY` step quick.

Reasoning:
  - nodejs-18 is in LTS until May 2025, but nodejs-20 will
    be in LTS until May 2026. [^1]

  - node and npm are distributed together, and the
    `ubi9/nodejs-20` container has a newer version of
    npm included (10.7.0) than the current `ubi9/nodejs-18`
    container (10.5.0)

  - Given github issues [^2] and [^3], we can assume that
    the only versions of npm that will be stable in CI
    during the `npm install` phase are `npm@9` and `npm@>=10.5.2`.
    Any npm version <10.5.2 is at severe risk of encountering
    network errors when installing packages, especially when
    running in a qemu environment for non-native architecture
    builds.

  - Being very specific in the `package.json` `engines` block
    will help keep everyone on working versions of npm.

[1]: https://nodejs.org/en/about/previous-releases
[2]: npm/cli#7231
[3]: npm/cli#7072

Signed-off-by: Scott J Dickerson <[email protected]>
  • Loading branch information
sjd78 committed Aug 22, 2024
1 parent e551af8 commit c669b6c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
5 changes: 3 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
*/dist/
**/node_modules
**/dist
hack/
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
# a specific version tag. Container build errors have come up locally
# and via github action workflow when `:latest` is updated.
#
# Image info: https://catalog.redhat.com/software/containers/ubi9/nodejs-18/62e8e7ed22d1d3c2dfe2ca01
# Image info: https://catalog.redhat.com/software/containers/ubi9/nodejs-20/64770ac7a835530172eee6a9
# Relevant PRs:
# - https://github.com/konveyor/tackle2-ui/pull/1746
# - https://github.com/konveyor/tackle2-ui/pull/1781

# Builder image
FROM registry.access.redhat.com/ubi9/nodejs-18:1-118 as builder
FROM registry.access.redhat.com/ubi9/nodejs-20:1-54 as builder

USER 1001
COPY --chown=1001 . .
RUN npm version && \
npm config --location=project set fetch-retry-maxtimeout 300000 && \
npm config --location=project set fetch-retry-mintimeout 60000 && \
npm config --location=project set fetch-timeout 600000 && \

RUN \
npm version && \
npm config ls && \
npm clean-install --verbose --ignore-scripts --no-audit && \
npm run build && \
npm run dist

# Runner image
FROM registry.access.redhat.com/ubi9/nodejs-18-minimal:1-123
FROM registry.access.redhat.com/ubi9/nodejs-20-minimal:1-57

# Add ps package to allow liveness probe for k8s cluster
# Add tar package to allow copying files with kubectl scp
Expand All @@ -48,6 +48,8 @@ LABEL name="konveyor/tackle2-ui" \

COPY --from=builder /opt/app-root/src/dist /opt/app-root/dist/

RUN ls -lR /opt/app-root/dist

ENV DEBUG=1

WORKDIR /opt/app-root/dist
Expand Down
17 changes: 9 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"client"
],
"engines": {
"node": ">=18.14.2",
"npm": ">=9.5.0"
"node": ">=20.12.2",
"npm": "^9.5.0 || ^10.5.2"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
Expand Down

0 comments on commit c669b6c

Please sign in to comment.