From f1dfedb2b7621533443eb15ea0bcb18f4d17d5e3 Mon Sep 17 00:00:00 2001 From: yaowenc2 Date: Thu, 25 Dec 2025 09:01:07 +0800 Subject: [PATCH 1/3] fix(pgvector): disable optimization flags for build compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add OPTFLAGS="" to pgvector make command to fix build issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- postgres/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres/Dockerfile b/postgres/Dockerfile index 9b90cb6..f3c85af 100644 --- a/postgres/Dockerfile +++ b/postgres/Dockerfile @@ -18,7 +18,7 @@ RUN apt-get update && apt-get install -y \ RUN cd /tmp && \ git clone --branch v0.7.4 https://github.com/pgvector/pgvector.git && \ cd pgvector && \ - make PG_CONFIG=/usr/lib/postgresql/15/bin/pg_config && \ + make PG_CONFIG=/usr/lib/postgresql/15/bin/pg_config OPTFLAGS="" && \ make install PG_CONFIG=/usr/lib/postgresql/15/bin/pg_config && \ cd / && \ rm -rf /tmp/pgvector From ef052526ce43fac589755a3208888715248432af Mon Sep 17 00:00:00 2001 From: yaowenc2 Date: Wed, 14 Jan 2026 14:08:41 -0800 Subject: [PATCH 2/3] feat(postgres): add pg_net extension for async HTTP requests - Add pg_net v0.14.0 build step using cargo-pgrx - Add libcurl4 runtime dependency - Update CLAUDE.md documentation Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 14 +++++++++++--- postgres/Dockerfile | 12 ++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 78d8873..856bb55 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -11,6 +11,7 @@ This repository builds a custom PostgreSQL 15.13 Docker image with pre-installed The custom Postgres image includes: - **pgvector** (v0.7.4) - Vector similarity search for embeddings - **pg_graphql** (v1.5.11) - GraphQL API generation from PostgreSQL schemas +- **pg_net** (v0.14.0) - Async HTTP/HTTPS requests from PostgreSQL - **TimescaleDB 2** - Time-series database capabilities - **PostGIS 3** - Spatial database support - **pg_cron** - Job scheduling within PostgreSQL @@ -68,8 +69,9 @@ git push origin v1.0.0 ### Extension Version Management When updating extension versions: -- **pgvector**: Update git tag in line 28 of [postgres/Dockerfile](postgres/Dockerfile#L28) -- **pg_graphql**: Update git checkout in line 44 of [postgres/Dockerfile](postgres/Dockerfile#L44) +- **pgvector**: Update git tag in line 19 of [postgres/Dockerfile](postgres/Dockerfile#L19) +- **pg_graphql**: Update git checkout in line 35 of [postgres/Dockerfile](postgres/Dockerfile#L35) +- **pg_net**: Update git checkout in line 45 of [postgres/Dockerfile](postgres/Dockerfile#L45) - **TimescaleDB, PostGIS, pg_cron, pg_http**: Managed via apt packages ### Build Dependencies @@ -79,6 +81,11 @@ When updating extension versions: - cargo-pgrx v0.12.9 (must match pg_graphql compatibility) - PostgreSQL server development files +- **pg_net** requires: + - Rust toolchain (installed via rustup) + - cargo-pgrx v0.12.9 (shared with pg_graphql) + - libcurl4 runtime dependency + - **pgvector** requires: - GCC compiler - PostgreSQL server development files @@ -94,11 +101,12 @@ docker exec -it psql -U postgres # Inside psql, check available extensions SELECT * FROM pg_available_extensions -WHERE name IN ('vector', 'pg_graphql', 'timescaledb', 'postgis', 'pg_cron', 'http'); +WHERE name IN ('vector', 'pg_graphql', 'pg_net', 'timescaledb', 'postgis', 'pg_cron', 'http'); # Enable extensions CREATE EXTENSION IF NOT EXISTS vector; CREATE EXTENSION IF NOT EXISTS pg_graphql; +CREATE EXTENSION IF NOT EXISTS pg_net; CREATE EXTENSION IF NOT EXISTS timescaledb; CREATE EXTENSION IF NOT EXISTS postgis; CREATE EXTENSION IF NOT EXISTS pg_cron; diff --git a/postgres/Dockerfile b/postgres/Dockerfile index f3c85af..ddcbdb2 100644 --- a/postgres/Dockerfile +++ b/postgres/Dockerfile @@ -38,6 +38,15 @@ RUN cd /tmp && \ cd / && \ rm -rf /tmp/pg_graphql +# Build pg_net (async HTTP requests) +RUN cd /tmp && \ + git clone https://github.com/supabase/pg_net.git && \ + cd pg_net && \ + git checkout v0.14.0 && \ + cargo pgrx install --release --pg-config=/usr/lib/postgresql/15/bin/pg_config && \ + cd / && \ + rm -rf /tmp/pg_net + # Final stage - clean runtime image FROM postgres:15.13 @@ -61,6 +70,7 @@ RUN apt-get update && apt-get install -y \ postgresql-15-postgis-3 \ postgis \ timescaledb-2-postgresql-15 \ + libcurl4 \ && rm -rf /var/lib/apt/lists/* # Copy compiled extensions from builder stage @@ -68,6 +78,8 @@ COPY --from=builder /usr/lib/postgresql/15/lib/vector.so /usr/lib/postgresql/15/ COPY --from=builder /usr/share/postgresql/15/extension/vector* /usr/share/postgresql/15/extension/ COPY --from=builder /usr/lib/postgresql/15/lib/pg_graphql.so /usr/lib/postgresql/15/lib/ COPY --from=builder /usr/share/postgresql/15/extension/pg_graphql* /usr/share/postgresql/15/extension/ +COPY --from=builder /usr/lib/postgresql/15/lib/pg_net.so /usr/lib/postgresql/15/lib/ +COPY --from=builder /usr/share/postgresql/15/extension/pg_net* /usr/share/postgresql/15/extension/ # Clean up unnecessary packages RUN apt-get purge -y lsb-release curl gnupg && \ From ccc96e77b12b6ffcf844ecfe91cbbe5bbc7bbf16 Mon Sep 17 00:00:00 2001 From: yaowenc2 Date: Wed, 14 Jan 2026 14:42:19 -0800 Subject: [PATCH 3/3] fix(pg_net): use make instead of cargo pgrx for C extension build pg_net is a C extension using libcurl, not a Rust/pgrx extension. - Add libcurl4-openssl-dev build dependency - Use make/make install instead of cargo pgrx - Add CFLAGS="-Wno-error" for compatibility with newer compilers - Update COPY pattern to handle versioned .so files Co-Authored-By: Claude Opus 4.5 --- postgres/Dockerfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/postgres/Dockerfile b/postgres/Dockerfile index ddcbdb2..706760c 100644 --- a/postgres/Dockerfile +++ b/postgres/Dockerfile @@ -38,14 +38,18 @@ RUN cd /tmp && \ cd / && \ rm -rf /tmp/pg_graphql -# Build pg_net (async HTTP requests) -RUN cd /tmp && \ +# Build pg_net (async HTTP requests) - C extension using libcurl +# Note: v0.14.0 has curl type warnings, disable -Werror for compatibility with newer compilers +RUN apt-get update && apt-get install -y libcurl4-openssl-dev && \ + cd /tmp && \ git clone https://github.com/supabase/pg_net.git && \ cd pg_net && \ git checkout v0.14.0 && \ - cargo pgrx install --release --pg-config=/usr/lib/postgresql/15/bin/pg_config && \ + make PG_CONFIG=/usr/lib/postgresql/15/bin/pg_config CFLAGS="-Wno-error" && \ + make install PG_CONFIG=/usr/lib/postgresql/15/bin/pg_config && \ cd / && \ - rm -rf /tmp/pg_net + rm -rf /tmp/pg_net && \ + rm -rf /var/lib/apt/lists/* # Final stage - clean runtime image FROM postgres:15.13 @@ -78,7 +82,8 @@ COPY --from=builder /usr/lib/postgresql/15/lib/vector.so /usr/lib/postgresql/15/ COPY --from=builder /usr/share/postgresql/15/extension/vector* /usr/share/postgresql/15/extension/ COPY --from=builder /usr/lib/postgresql/15/lib/pg_graphql.so /usr/lib/postgresql/15/lib/ COPY --from=builder /usr/share/postgresql/15/extension/pg_graphql* /usr/share/postgresql/15/extension/ -COPY --from=builder /usr/lib/postgresql/15/lib/pg_net.so /usr/lib/postgresql/15/lib/ +# pg_net may create versioned .so files, copy all matching patterns +COPY --from=builder /usr/lib/postgresql/15/lib/pg_net*.so /usr/lib/postgresql/15/lib/ COPY --from=builder /usr/share/postgresql/15/extension/pg_net* /usr/share/postgresql/15/extension/ # Clean up unnecessary packages