I am behind a corporate firewall and I have a node.js application to deploy on Openshift container via a docker image. The application requires oracledb add-on binaries - Oracle InstantClient packages to be configured on the server.
I have following Dockerfile:
FROM devops-automation-docker<....>/rhel7-nodejs-10:latest
RUN mkdir -p /opt/oracle
# set working directory
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
ENV PATH /usr/src/app/node_modules/.bin:$PATH
COPY . .
RUN mv instantclient_11_2 /opt/oracle
ENV LD_LIBRARY_PATH /opt/oracle/instantclient_11_2
RUN sh -c "echo /opt/oracle/instantclient_11_2 > /etc/ld.so.conf.d/oracle-instantclient.conf" && \
ldconfig && \
echo ${LD_LIBRARY_PATH} && \
npm ci
EXPOSE 3002
CMD ["node", "server.js"]
The build is getting successful but when I deploy and run, it throws me following error:
/usr/src/app/design-pattern-exemplars/node_modules/oracledb/lib/oracledb.js:68 throw new Error(nodbUtil.getErrorMessage('NJS-045', nodeInfo)); ^
Error: NJS-045: cannot load the oracledb add-on binary for Node.js 10.16.0 (linux, x64) Cannot load /usr/src/app/design-pattern-exemplars/node_modules/oracledb/build/Release/oracledb.node /usr/src/app/design-pattern-exemplars/node_modules/oracledb/build/Release/oracledb.node: invalid ELF header Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html You must have 64-bit Oracle client libraries in LD_LIBRARY_PATH, or configured with ldconfig. If you do not have Oracle Database on this computer, then install the Instant Client Basic or Basic Light package from http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
at Object.<anonymous> (/usr/src/app/design-pattern-exemplars/node_modules/oracledb/lib/oracledb.js:68:13) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (/usr/src/app/design-pattern-exemplars/node_modules/oracledb/index.js:1:18) at Module._compile (internal/modules/cjs/loader.js:776:30)
What am I doing wrong?
P.S. the first 2 commands were added after I saw some other post on SO which had some similar type of issue but it wasn't with docker and was run via sudo.
Please help! I went through other posts since last 10 days and I feel helpless now. Let me know if anything else is required.