yocontra / node-gdal-next

Node.js bindings for GDAL (Geospatial Data Abstraction Library) [Fork]
https://contra.io/node-gdal-next/
Apache License 2.0
75 stars 35 forks source link

[Question] run in docker #55

Closed petr-pokorny-1 closed 2 years ago

petr-pokorny-1 commented 2 years ago

Hi, I am wondering if anyone has the luck to use this binding in docker. I used node 14 on alpine 3.14 and installed GDAL (following osgeo/gdal official image), but I am getting the following error when I try to run the container:

backend_1  | internal/modules/cjs/loader.js:1131
backend_1  |   return process.dlopen(module, path.toNamespacedPath(filename));
backend_1  |                  ^
backend_1  | 
backend_1  | Error: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /usr/src/app/node_modules/gdal-next/lib/binding/node-v83-linux-x64/gdal.node)
backend_1  |     at Object.Module._extensions..node (internal/modules/cjs/loader.js:1131:18)
backend_1  |     at Module.load (internal/modules/cjs/loader.js:937:32)
b
yocontra commented 2 years ago

@petr-pokorny-1 Not sure what the issue with alpine would be - I've used this library in docker in production for a few years now without issue, but not with alpine just using a normal node image and the prebuilt binaries. I would think you're probably missing something with linking your preinstalled gdal with the module. Make sure you follow the instructions in the readme and do npm install gdal-next --build-from-source --shared_gdal to use your system gdal.

petr-pokorny-1 commented 2 years ago

@contra I couldn't figure out why it does not work with Alpine, but it started working when I used osgeo/gdal:ubuntu-small-latest as a base image and installed node on it. I did not need libgdal-dev and --build-from-source - it just worked out of the box.

Thank you for your help and for maintaining this library!

stefanocudini commented 1 year ago

I couldn't figure out why it does not work with Alpine, but it started working when I used osgeo/gdal:ubuntu-small-latest as a base image and installed node on it. I did not need libgdal-dev and --build-from-source - it just worked out of the box.

@petr-pokorny-1 have you also succeeded with alpine? I am making attempts here: https://github.com/opengeo-tech/geotiff-picker/blob/master/Dockerfile#L5