Skip to content

add PLV8 extension #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ jobs:
psql -c "INSERT INTO test_geometry_table (geom) VALUES (ST_GeomFromText('POINT(0 0)', 4326));"
psql -c "SELECT * FROM test_geometry_table;"

echo "Test PostGIS Geometry Function"
psql -c "CREATE EXTENSION plv8;"
psql -c "SELECT plv8_version();"
psql -c "DO $$ plv8.elog(NOTICE, "hello there!"); $$ LANGUAGE plv8;"

break
fi
sleep 1
Expand Down
38 changes: 37 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,40 @@ RUN set -eux \
# clean
&& cd / \
&& rm -rf /usr/src/postgis \
&& apk del .fetch-deps .build-deps
&& apk del .fetch-deps .build-deps
# Add plv8 Extension
ARG PLV8_VERSION

RUN set -ex && apk update \
&& apk add --no-cache --virtual .v8-build \
libstdc++-dev \
binutils \
gcc \
libc-dev \
g++ \
ca-certificates \
curl \
make \
libbz2 \
linux-headers \
cmake \
clang15-libs \
clang15 \
llvm15 \
ncurses-libs \
zlib-dev \
git \
python3 \
&& mkdir -p /tmp/build \
&& curl -o /tmp/build/v$PLV8_VERSION.tar.gz -SL "https://github.com/plv8/plv8/archive/refs/tags/v${PLV8_VERSION}.tar.gz" \
&& cd /tmp/build \
&& tar -xzf /tmp/build/v$PLV8_VERSION.tar.gz -C /tmp/build/ \
&& cd /tmp/build/plv8-$PLV8_VERSION \
&& git clone --depth 1 https://github.com/bnoordhuis/v8-cmake.git ./deps/v8-cmake \
&& git init \
&& make \
&& make install \
&& strip /usr/local/lib/postgresql/plv8-${PLV8_VERSION}.so \
&& apk del --no-network .v8-build; \
&& rm -rf /tmp/* /var/tmp/*

4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PG_VER_NUMBER=$(shell echo $(PG_VER) | cut -c3-)
TS_VERSION=2.13.0
PG_CRON_VERSION=v1.6.0
POSTGIS_VERSION=3.4.1
PLV8_VERSION=3.2.2
PREV_TS_VERSION=$(shell wget --quiet -O - https://raw.githubusercontent.com/timescale/timescaledb/${TS_VERSION}/version.config | grep update_from_version | sed -e 's!update_from_version = !!')
PREV_TS_IMAGE="timescale/timescaledb:$(PREV_TS_VERSION)-pg$(PG_VER_NUMBER)$(PREV_EXTRA)"
PREV_IMAGE=$(shell if docker pull $(PREV_TS_IMAGE) >/dev/null; then echo "$(PREV_TS_IMAGE)"; else echo "postgres:$(PG_VER_NUMBER)-alpine"; fi )
Expand All @@ -30,7 +31,8 @@ DOCKER_BUILD_ARGS = --build-arg TS_VERSION=$(TS_VERSION) \
--build-arg PG_VERSION=$(PG_VER_NUMBER) \
--build-arg PREV_IMAGE=$(PREV_IMAGE) \
--build-arg PG_CRON_VERSION=$(PG_CRON_VERSION) \
--build-arg POSTGIS_VERSION=$(POSTGIS_VERSION)
--build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) \
--build-arg PLV8_VERSION=$(PLV8_VERSION)


default: image
Expand Down
39 changes: 39 additions & 0 deletions bitnami/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,45 @@ RUN set -eux \
/tmp/* \
/var/tmp/*

ARG PLV8_VERSION

RUN buildDependencies="build-essential \
ca-certificates \
curl \
git-core \
gpp \
cpp \
gnupg dirmngr \
pkg-config \
apt-transport-https \
cmake \
libc++-dev \
libncurses5 \
libc++abi-dev \
libstdc++-12-dev \
wget \
zlib1g-dev \
postgresql-server-dev-15 \
libtinfo5" \
runtimeDependencies="libc++1" \
&& set -ex \
&& apt-get update && apt-get install -y --no-install-recommends ${buildDependencies} ${runtimeDependencies} \
&& mkdir -p /tmp/build \
&& curl -o /tmp/build/v$PLV8_VERSION.tar.gz -SL "https://github.com/plv8/plv8/archive/refs/tags/v${PLV8_VERSION}.tar.gz" \
&& cd /tmp/build \
&& tar -xzf /tmp/build/v$PLV8_VERSION.tar.gz -C /tmp/build/ \
&& cd /tmp/build/plv8-$PLV8_VERSION \
&& git clone --depth 1 https://github.com/bnoordhuis/v8-cmake.git ./deps/v8-cmake \
&& git init \
&& make \
&& make install \
&& strip /opt/bitnami/postgresql/lib/plv8-${PLV8_VERSION}.so \
&& apt-get clean \
&& apt-get remove -y ${buildDependencies} \
&& apt-get autoremove -y \
&& rm -rf tmp/build /var/lib/apt/lists/*


USER 1001

ENTRYPOINT [ "/opt/bitnami/scripts/postgresql/timescaledb-bitnami-entrypoint.sh" ]
Expand Down
4 changes: 3 additions & 1 deletion bitnami/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PG_VER_NUMBER=$(shell echo $(PG_VER) | cut -c3-)
PG_CRON_VERSION=v1.6.0
TS_VERSION=2.13.0
POSTGIS_VERSION=3.4.1
PLV8_VERSION=3.2.2
PREV_TS_VERSION=$(shell wget --quiet -O - https://raw.githubusercontent.com/timescale/timescaledb/${TS_VERSION}/version.config | grep update_from_version | sed -e 's!update_from_version = !!')
PREV_TS_IMAGE="timescale/timescaledb:$(PREV_TS_VERSION)-pg$(PG_VER_NUMBER)-bitnami"
PREV_IMAGE=$(shell if docker pull $(PREV_TS_IMAGE) >/dev/null; then echo "$(PREV_TS_IMAGE)"; else echo "bitnami/postgresql:$(PG_VER_NUMBER)"; fi )
Expand All @@ -27,7 +28,8 @@ DOCKER_BUILD_ARGS = --build-arg PG_VERSION=$(PG_VER_NUMBER) \
--build-arg TS_VERSION=$(TS_VERSION) \
--build-arg PREV_IMAGE=$(PREV_IMAGE) \
--build-arg PG_CRON_VERSION=$(PG_CRON_VERSION) \
--build-arg POSTGIS_VERSION=$(POSTGIS_VERSION)
--build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) \
--build-arg PLV8_VERSION=$(PLV8_VERSION)


default: image
Expand Down