-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile.with-extensions.x86_64
50 lines (39 loc) · 2.28 KB
/
Dockerfile.with-extensions.x86_64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
FROM amazon/aws-lambda-nodejs:16 as builder
ARG DUCKDB_VERSION=1.1.3
ARG ARCHITECTURE=x86_64
# Install dependencies
RUN yum update -y && \
yum install git zip ninja-build make gcc-c++ openssl11-devel python-pip python3 -y && \
yum remove cmake -y && \
pip install cmake --upgrade
# Get DuckDB sources
RUN mkdir -p /tmp/from-git && \
cd /tmp/from-git && \
git clone --branch "main" https://github.com/duckdb/duckdb-node.git && \
cd duckdb-node && \
git fetch --all --tags && \
git checkout v${DUCKDB_VERSION}
# Configure
RUN cd /tmp/from-git/duckdb-node && npm i && STATIC_OPENSSL=1 CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) make
# Copy local binding definition
COPY src/lib/duckdb-binding.js /tmp/from-git/duckdb-node/lib/duckdb-binding.js
# Copy updated package.json
COPY src/package.json /tmp/from-git/duckdb-node/package.json
# Copy updated README.md
COPY src/README.md /tmp/from-git/duckdb-node/README.md
# Create folders
RUN mkdir -p /tmp/build/nodejs/node_modules/duckdb/lib /tmp/build/nodejs/node_modules/duckdb/release /tmp/build/nodejs/node_modules/duckdb/extensions /tmp/release
# Integrate needed extensions
COPY release/extensions/v1.1.1/arrow.duckdb_extension.gz /tmp/build/nodejs/node_modules/duckdb/extensions/arrow.duckdb_extension.gz
COPY release/extensions/v1.1.1/aws.duckdb_extension.gz /tmp/build/nodejs/node_modules/duckdb/extensions/aws.duckdb_extension.gz
COPY release/extensions/v1.1.1/httpfs.duckdb_extension.gz /tmp/build/nodejs/node_modules/duckdb/extensions/httpfs.duckdb_extension.gz
# Unpack extensions
RUN cd /tmp/build/nodejs/node_modules/duckdb/extensions && gunzip *.gz
# Create zip file with layer contents
RUN cp /tmp/from-git/duckdb-node/lib/*.js /tmp/build/nodejs/node_modules/duckdb/lib && \
cp /tmp/from-git/duckdb-node/README.md /tmp/build/nodejs/node_modules/duckdb/README.md && \
cp /tmp/from-git/duckdb-node/package.json /tmp/build/nodejs/node_modules/duckdb/package.json && \
cp /tmp/from-git/duckdb-node/duckdb.js /tmp/build/nodejs/node_modules/duckdb/duckdb.js && \
cp /tmp/from-git/duckdb-node/build/Release/duckdb.node /tmp/build/nodejs/node_modules/duckdb/release/duckdb.node && \
cd /tmp/build/nodejs/node_modules/duckdb && npm version ${DUCKDB_VERSION} || true && \
cd /tmp/build && zip -q -r /tmp/release/duckdb-extensions-layer-${ARCHITECTURE}.zip .