Skip to content

Commit 82377ae

Browse files
WarpSQL/normal: Add ZomboDB extension build to Dockerfile
1. This commit adds the necessary commands to the Dockerfile to build and install the ZomboDB extension for PostgreSQL. 2. The build process uses cargo-pgrx and clang to compile the Rust code and create a PostgreSQL extension that can be installed via CREATE EXTENSION. 3. The resulting extension is included in the final Docker image. 4. This feature is useful for users who need to use ZomboDB's full-text search capabilities in their PostgreSQL databases. 5. The version of PostgreSQL can be specified via a build argument PG_VER. 6. The commit also adds some necessary dependencies, such as Ruby and FPM, to the Dockerfile. Fixes: #5
1 parent 02b1678 commit 82377ae

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

.github/workflows/smoke-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ jobs:
7171
psql -c "INSERT INTO test_geometry_table (geom) VALUES (ST_GeomFromText('POINT(0 0)', 4326));"
7272
psql -c "SELECT * FROM test_geometry_table;"
7373
74+
psql -c "CREATE EXTENSION zombodb;"
75+
psql -c "SELECT * FROM pg_extension WHERE extname = 'zombodb';"
76+
7477
break
7578
fi
7679
sleep 1

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,33 @@ RUN set -eux \
226226
&& cd / \
227227
&& rm -rf /usr/src/postgis \
228228
&& apk del .fetch-deps .build-deps
229+
230+
ENV RUSTFLAGS="-C target-feature=-crt-static"
231+
ARG PG_VER
232+
RUN apk add --no-cache --virtual .zombodb-build-deps \
233+
git \
234+
curl \
235+
bash \
236+
ruby-dev \
237+
ruby-etc \
238+
musl-dev \
239+
make \
240+
gcc \
241+
coreutils \
242+
util-linux-dev \
243+
musl-dev \
244+
openssl-dev \
245+
clang-libs \
246+
clang-dev \
247+
tar \
248+
&& gem install --no-document fpm \
249+
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y \
250+
&& PATH=$HOME/.cargo/bin:$PATH \
251+
&& cargo install cargo-pgrx \
252+
&& cargo pgrx init --${PG_VER}=$(which pg_config) \
253+
&& git clone https://github.com/zombodb/zombodb.git \
254+
&& cd ./zombodb \
255+
&& cargo pgrx install --release \
256+
&& cd .. \
257+
&& rm -rf ./zombodb \
258+
&& apk del .zombodb-build-deps

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ default: image
5757
touch .build_$(TS_VERSION)_$(PG_VER)_oss
5858

5959
.build_$(TS_VERSION)_$(PG_VER): Dockerfile
60-
docker build --build-arg PG_VERSION=$(PG_VER_NUMBER) --build-arg TS_VERSION=$(TS_VERSION) --build-arg PREV_IMAGE=$(PREV_IMAGE) --build-arg CITUS_VERSION=$(CITUS_VERSION) --build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) --build-arg POSTGIS_SHA256=$(POSTGIS_SHA256) $(TAG) .
60+
docker build --build-arg PG_VERSION=$(PG_VER_NUMBER) --build-arg TS_VERSION=$(TS_VERSION) --build-arg PREV_IMAGE=$(PREV_IMAGE) --build-arg CITUS_VERSION=$(CITUS_VERSION) --build-arg PG_VER=$(PG_VER) --build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) --build-arg POSTGIS_SHA256=$(POSTGIS_SHA256) $(TAG) .
6161
touch .build_$(TS_VERSION)_$(PG_VER)
6262

6363
image: .build_$(TS_VERSION)_$(PG_VER)

0 commit comments

Comments
 (0)