diff --git a/src/nodejs/.dockerignore b/src/nodejs/.dockerignore index 48912d2..3c3629e 100644 --- a/src/nodejs/.dockerignore +++ b/src/nodejs/.dockerignore @@ -1,2 +1 @@ -build -node_modules \ No newline at end of file +node_modules diff --git a/src/nodejs/Dockerfile b/src/nodejs/Dockerfile index 7c440c7..8d3eedd 100644 --- a/src/nodejs/Dockerfile +++ b/src/nodejs/Dockerfile @@ -4,12 +4,15 @@ # update the `NODE_OPTIONS` environment variable accordingly. # In the first stage, install all the required packages in one custom directory. # Then in the second stage, copy the directory to `/instrumentation`. -# - Ensure you have `newrelic`, `@newrelic/aws-sdk`, `@newrelic/koa`, `@newrelic/superagent`, and `@newrelic/native-metrics` +# - Ensure you have `newrelic`, and`@newrelic/native-metrics`. # - Grant the necessary access to `/instrumentation` directory. `chmod -R go+r /instrumentation` -FROM node:20.12 AS build +ARG NODE_RUNTIME_VERSION=20 +ARG NEWRELIC_NODE_AGENT_VERSION=latest + +FROM node:${NODE_RUNTIME_VERSION} AS build WORKDIR /operator-build COPY . . -RUN npm install +RUN npm install newrelic@${NEWRELIC_NODE_AGENT_VERSION} FROM busybox COPY --from=build /operator-build/build/workspace /instrumentation diff --git a/src/nodejs/newrelicinstrumentation.js b/src/nodejs/newrelicinstrumentation.js new file mode 100644 index 0000000..2d96cb5 --- /dev/null +++ b/src/nodejs/newrelicinstrumentation.js @@ -0,0 +1 @@ +require('newrelic') diff --git a/src/nodejs/package.json b/src/nodejs/package.json deleted file mode 100644 index 07f6dd4..0000000 --- a/src/nodejs/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "newrelic", - "version": "0.0.1", - "private": true, - "scripts": { - "clean": "rimraf build/*", - "prepare": "npm run compile", - "compile": "tsc -p .", - "postcompile": "copyfiles -f 'build/src/**' build/workspace/ && copyfiles 'node_modules/**' build/workspace/" - }, - "devDependencies": { - "copyfiles": "^2.4.1", - "rimraf": "^5.0.5", - "typescript": "^5.4.3" - }, - "dependencies": { - "newrelic": "11.15.0" - } -} diff --git a/src/nodejs/src/newrelicinstrumentation.ts b/src/nodejs/src/newrelicinstrumentation.ts deleted file mode 100644 index cac9f6d..0000000 --- a/src/nodejs/src/newrelicinstrumentation.ts +++ /dev/null @@ -1,3 +0,0 @@ -const newrelic = require('newrelic'); - -export { newrelic }; diff --git a/src/nodejs/tsconfig.json b/src/nodejs/tsconfig.json deleted file mode 100644 index 300f52b..0000000 --- a/src/nodejs/tsconfig.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "composite": true, - "declaration": true, - "declarationMap": true, - "forceConsistentCasingInFileNames": true, - "incremental": true, - "inlineSources": true, - "module": "commonjs", - "newLine": "LF", - "noEmitOnError": true, - "noFallthroughCasesInSwitch": true, - "noImplicitOverride": true, - "noImplicitReturns": true, - "noUnusedLocals": true, - "pretty": true, - "skipLibCheck": true, - "sourceMap": true, - "strict": true, - "strictNullChecks": true, - "target": "es2017" - }, - "include": [ - "src/**/*.ts", - ] -} \ No newline at end of file