I’m trying to put the Aerospike Node.js client into an alpine Docker container. This needs some building the client-c-src. The actual build process is split up into 3 different stages.
Stage 1: Build Aerospike C client (this one succeeds)
Stage 2: Build Aerospike Node.js client (this one fails)
Stage 3: Aerospike Node.js Runtime (this one is skipped)
FYI: The Dockerfile and the build logs are attached to this post. docker.tar.gz (16.9 KB)
Basically the issue is that node-gyp rebuild is failing at some point with the following error message.
../src/main/enums/status.cc: In function 'v8::Local<v8::Object> status()':
../src/main/enums/status.cc:90:49: error: 'AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND' was not declared in this scope
set(obj, "AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND", AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/main/enums/status.cc:26:92: note: in definition of macro 'set'
#define set(__obj, __name, __value) __obj->Set(Nan::New(__name).ToLocalChecked(), Nan::New(__value))
^~~~~~~
../src/main/enums/status.cc:90:49: note: suggested alternative: 'AEROSPIKE_ERR_LUA_FILE_NOT_FOUND'
set(obj, "AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND", AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/main/enums/status.cc:26:92: note: in definition of macro 'set'
#define set(__obj, __name, __value) __obj->Set(Nan::New(__name).ToLocalChecked(), Nan::New(__value))
^~~~~~~
Has anyone stumbled upon a similar issue and can point me here in the right direction?
Sorry for the late response. However, thank you so much for the help @Jan. I’ll give it a try with the Node.js client 3.13.0 and the C client with 4.6.7.
Building the Dockerfile even when the version is set to 4.6.7 seems to fail with my setup. Actually the only thing I wanted to achieve was to base my Dockerfile on node:10-alpine and not node:10-slim. It seems that I did make it altogether too complicated.
I had a look at closed issues concerning Alpine on the GitHub repository for the Node.js client. Luckily, you were active there, too
The only negative point is now the bit bigger size of all image layers for the created image which is now around 678 MB. For the approach with node:10-slim, I’m at 631 MB. This means I’ll stay with the following Dockerfile for my Node.js 10 with Yarn.
FROM node:10-slim
RUN apt-get update
RUN apt-get install python make g++ openssl libssl-dev libz-dev -y
RUN npm install -g yarn
WORKDIR /workdir
COPY package.json .
COPY yarn.lock .
COPY tools/preinstall.js tools/preinstall.js
RUN yarn install --production=true --pure-lockfile
COPY . .
EXPOSE 80
HEALTHCHECK CMD curl --fail http://0.0.0.0/ || exit 1
CMD [ "yarn", "start" ]
Note that the Dockerfile I had posted in issue #299 on Github is not optimized for image size. For a real production build, you would probably want to remove both the C client repo as well as the whole C/C++ build toolchain again, once the C client SDK and Node.js client were build successfully. That should drastically reduce the final image size.