-
Notifications
You must be signed in to change notification settings - Fork 9
/
postgres_duckdb.docker
45 lines (40 loc) · 1.48 KB
/
postgres_duckdb.docker
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
ARG base_tag=16.3
FROM postgres:${base_tag}
ARG pg_version=16
ARG fdw_version=1.0.0
# must be *.zip resource
ARG fdw_url=https://github.com/alitrack/duckdb_fdw/archive/refs/tags/v1.0.0.zip
ARG duckdb_lib_url=https://github.com/duckdb/duckdb/releases/download/v1.0.0/libduckdb-linux-amd64.zip
ARG source_files=/tmp/duckdb_fdw
ARG source_root=duckdb_fdw-1.0.0
RUN apt-get update;
# compilation deps
RUN apt-get install -y --no-install-recommends wget unzip ca-certificates \
make gcc g \
postgresql-server-dev-${pg_version}; \
# duckdb_fdw
rm -rf ${source_files}; \
mkdir -p ${source_files}; \
wget -O sources.zip ${fdw_url}; \
unzip sources.zip -d ${source_files}; \
rm sources.zip; \
cd ${source_files}/${source_root}; \
# duckdb lib
# it must be extracted into the same directory as duckdb_fdw source files
# compilation process requires duckdb.h and duckdb.hpp files to be in the same directory
# as the duckdb_fdw source files
wget -O sources.zip ${duckdb_lib_url}; \
unzip sources.zip -d .; \
# it's also required to copy the libduckdb.so to the postgresql lib directory
cp ./libduckdb.so $(pg_config --libdir); \
rm sources.zip; \
# install
make USE_PGXS=1; \
make USE_PGXS=1 install; \
# cleanup
apt-get purge -y --auto-remove wget unzip ca-certificates \
make gcc g \
postgresql-server-dev-${pg_version}; \
cd -; \
rm -rf ${source_files}; \
rm -rf /var/lib/apt/lists/*;