Skip to content

Instantly share code, notes, and snippets.

@eSlider
Last active August 19, 2024 17:24
Show Gist options
  • Save eSlider/7ec4f0c4785d3fd8b634a7c674e34a3d to your computer and use it in GitHub Desktop.
Save eSlider/7ec4f0c4785d3fd8b634a7c674e34a3d to your computer and use it in GitHub Desktop.
postgresql 16 with timescaledb, duckdb and python as procedure languge enabled
FROM postgres:16
MAINTAINER Andriy Oblivantsev <[email protected]>
# Set the environment variables
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ "Europe/Madrid"
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Update the package repository
RUN apt-get update && apt install -y \
python3-pip \
golang-go \
cmake gnupg postgresql-common apt-transport-https lsb-release wget git wget unzip busybox build-essential \
postgresql-server-dev-16 \
postgresql-plpython3-16 \
libsqlite3-dev \
python3-pip
# Download and install duckdb precompiled binary and library
RUN wget -c https://github.com/duckdb/duckdb/releases/download/v1.0.0/libduckdb-linux-amd64.zip && \
unzip -d duckdb libduckdb-linux-amd64.zip && \
wget https://github.com/duckdb/duckdb/releases/download/v1.0.0/duckdb_cli-linux-amd64.zip && \
unzip -d duckdb duckdb_cli-linux-amd64.zip && \
rm -f *.zip && \
cp -f ./duckdb/libduckdb.so /usr/local/lib/ && \
cp -f ./duckdb/libduckdb.so /usr/lib64/ && \
cp -f ./duckdb/duckdb /usr/local/bin/ && \
ldconfig
# Get the duckdb_fdw extension and install it
RUN git clone https://github.com/alitrack/duckdb_fdw && \
cd duckdb_fdw && \
make USE_PGXS=1 && \
make install USE_PGXS=1
## Download and install timescaledb
RUN git clone --depth 1 --branch 2.15.1 https://github.com/timescale/timescaledb && \
cd timescaledb # && \
pip install cmake --break-system-packages && \
./bootstrap && \
cd build && \
make && \
make install
# Install the timescaledb-tune utility
#RUN go install github.com/timescale/timescaledb-parallel-copy/cmd/timescaledb-parallel-copy@latest
RUN go install github.com/timescale/timescaledb-tune/cmd/timescaledb-tune@latest && \
ln -s /root/go/bin/timescaledb-tune /usr/local/bin/timescaledb-tune
# ln -s /root/go/bin/timescaledb-tune /usr/local/bin/timescaledb-tune && \
# timescaledb-tune --quiet --yes --conf-path=/etc/postgresql.conf
## Install the pg_partman extension \
RUN git clone https://github.com/pgpartman/pg_partman --depth 1 --branch v5.1.0 && \
cd pg_partman && \
make && \
make install
# If you do not want the background worker compiled and just want the plain PL/PGSQL functions, you can run this instead: \
# make NO_BGW=1 install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment