My end goal is to execute a tippecanoe binary on a Lambda. This was possible with older versions of node lambdas (v8) however in the newer versions some shared objects are no longer available on the execution environments. I am able to create and upload lambda layers with the follower Dockerfile
FROM lambci/lambda:build-provided
RUN yum install -y make sqlite-devel build-essential libsqlite3-dev zlib1g-dev bash git gcc-c++
# Create a build directory; clone tippecanoe; and copy in all files
RUN mkdir -p /build
RUN git clone https://github.com/mapbox/tippecanoe.git /build/tippecanoe --depth 1
# Install system dependencies
WORKDIR /build/tippecanoe
# Build tippecanoe
RUN make && make install
# Copy binaries to `/opt`
RUN cp ./tippecanoe /opt/tippecanoe
RUN cp ./tile-join /opt/tile-join
With this I can execute the following node.js lambda
export const handler = async (event: SQSEvent): Promise<any> => {
await executeTippeCanoe();
};
async function executeTippeCanoe() {
try {
const { stdout, stderr } = await asyncExec('/opt/tippecanoe --version');
console.log('stdout:', stdout);
console.log('stderr:', stderr);
} catch (err: any) {
console.error(err);
};
};
It creates the tippecanoe binary correctly but it depends on some shared objects and results in error while loading shared libraries: libsqlite3.so.0
.
Though much trial and error I found that if I was able to locate libsqlite3.so.0 and place it in a /lib/
directory in the layer it would work but just result in more missing shared objects. I am wondering how I can use Docker to export all of these shared dependencies installed via yum
into a Docker layer.