Docker image for Nodejs and Couchbase SDK

So we have a nodejs micro-service using the NodeJS Couchbase SDK 3.2 We are trying to build a minimal docker image for our App using the Alpine base image but it seems the sdk needs more than what we have added to our base image.

Here is our dockerfile

FROM node:12-alpine3.13

RUN apk add --no-cache --virtual .gyp python3 make g++

WORKDIR /app

COPY package*.json ./

COPY .npmrc ./

RUN npm cache clean --force
RUN rm -rf node_modules
RUN npm install --only=production

RUN rm -rf .gyp

COPY . .

CMD [ “npm”, “start”]

We run into the following error,

Error: Error loading shared library libresolv.so.2: No such file or directory (needed by /app/node_modules/couchbase/build/Release/couchbase_impl.node)
at Object.Module._extensions…node (internal/modules/cjs/loader.js:1187:18)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.bindings [as default] (/app/node_modules/bindings/bindings.js:112:48)
at Object. (/app/node_modules/couchbase/dist/binding.js:70:35)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)

Is there any extra alpine lib we need to add ?

EDIT: This issue seems to be deeper than I thought. Refer to this thread : Use shared library that uses glibc on AlpineLinux

So it says Alpine uses musl as a c lib and apparently couchbase needs glibc ?



Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)