Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
fix: use npm v8 in expressapp container to workaround slow npm instal…
Browse files Browse the repository at this point in the history
…l from github

The switch to node v16 gets use npm v8, to workaround an issue with
slow 'npm install <any github repo dependency>'. See:
    npm/cli#4896

In our case the github repo dependency was the command given to docker
run this container:
    bash -c "npm install elastic-apm-node#SOME-COMMIT-SHA && node app.js"

This also adds a package.json to more explicitly declare we are working
with a node project workspace. Also avoid generating a package-lock file
we won't use.

Fixes: #1483
  • Loading branch information
trentm committed May 16, 2022
1 parent 601c06a commit 7f990a6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions docker/nodejs/express/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
8 changes: 4 additions & 4 deletions docker/nodejs/express/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM node:12.18.1
FROM node:16.15.0

RUN mkdir -p /app
RUN npm install express

COPY app.js /app
COPY package.json .npmrc app.js /app/

WORKDIR /app
RUN npm install

9 changes: 9 additions & 0 deletions docker/nodejs/express/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "expressapp",
"version": "1.0.0",
"private": true,
"main": "app.js",
"dependencies": {
"express": "*"
}
}

0 comments on commit 7f990a6

Please sign in to comment.