@@ -47,6 +47,62 @@ $ npm install @newrelic/native-metrics --build-from-source
47
47
48
48
For more information, please see the agent [ installation guide] [ install-node ] and [ compatibility and requirements] [ compatibility ] .
49
49
50
+ ### Musl Libc Systems
51
+
52
+ As noted above, this module ships pre-built binaries for most standard systems,
53
+ i.e. systems based on the [ GNU C Library] ( https://en.wikipedia.org/wiki/Glibc ) .
54
+ As of August 2024, Node.js does not provide "official" releases that are based
55
+ on [ musl libc] ( https://en.wikipedia.org/wiki/Musl ) ; such builds are only
56
+ available via the [ unofficial builds] ( https://github.com/nodejs/unofficial-builds )
57
+ project. Therefore, if deploying to musl based systems, e.g. Alpine Linux, you
58
+ must provide a [ node-gyp] ( https://github.com/nodejs/node-gyp ) compatible build
59
+ environment.
60
+
61
+ As an example, to install and use this module on an Alpine Linux based Docker
62
+ image, we can utilize the [ multi-stage build] ( https://docs.docker.com/build/building/multi-stage/ )
63
+ pattern to build a compatible image:
64
+
65
+ ** package.json** :
66
+ ``` json
67
+ {
68
+ "dependencies" : {
69
+ "@newrelic/native-metrics" : " ^11.0.0"
70
+ }
71
+ }
72
+ ```
73
+
74
+ ** index.js** :
75
+ ``` js
76
+ ' use strict'
77
+
78
+ const metrics = require (' @newrelic/native-metrics' )
79
+ console .log (" gcEnabled:" , metrics ().gcEnabled )
80
+ ```
81
+
82
+ ** Dockerfile** :
83
+ ``` Dockerfile
84
+ FROM node:20-alpine AS builder
85
+
86
+ WORKDIR /app
87
+ COPY index.js package.json .
88
+
89
+ RUN apk add g++ make py3-pip
90
+ RUN npm install --production
91
+
92
+ FROM node:20-alpine
93
+ COPY --from=builder app/ /app/
94
+ WORKDIR /app
95
+ CMD node index.js
96
+ ```
97
+
98
+ With those files in place, we can build and run the image:
99
+
100
+ ``` sh
101
+ $ docker build --tag demo .
102
+ $ docker run --rm -it demo
103
+ gcEnabled: true
104
+ ```
105
+
50
106
## Usage
51
107
52
108
``` js
0 commit comments