Skip to content

improve installation experience #96

@mrl5

Description

@mrl5

As a user I would like to easily install pg_jsonschema in my postgres container

Great user experience example is pg_cron where I can just

apt-get -y install postgresql-18-cron

resulting in this slick Dockerfile:

FROM docker.io/library/postgres:18

RUN apt-get update \
    && apt-get install -y --no-install-recommends postgresql-18-cron \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

if I am not mistaken, the only way to have pg_jsonschema is to build it first -- it results in bloated Dockerfile.

It would be cool to make a commit like this in one of my repos:

-FROM docker.io/library/rust:trixie as pg_jsonschema
-
-RUN apt-get update \
-    && apt-get install -y --no-install-recommends postgresql-common \
-    && echo | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
-
-RUN apt-get update \
-    && apt-get install -y --no-install-recommends \
-        postgresql-18 postgresql-server-dev-18 \
-        # pgrx deps
-        libclang-dev build-essential libreadline-dev zlib1g-dev flex bison \
-        libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache \
-        pkg-config \
-        git ca-certificates \
-    && git clone https://github.com/supabase/pg_jsonschema
-
-WORKDIR /pg_jsonschema
-# pg_jsonschema v0.3.4
-RUN git checkout cbe74b570d38aa0c4d42914e7a118bcb3adaee7a \
-    && cargo install --locked --version 0.16.1 cargo-pgrx \
-    && cargo pgrx init --pg18 $(which pg_config) \
-    && cargo pgrx install --pg-config=$(which pg_config) --release
-
 FROM docker.io/library/postgres:18
 
-COPY --from=pg_jsonschema /usr/lib/postgresql/18/lib/pg_jsonschema*.so /usr/lib/postgresql/18/lib/
-COPY --from=pg_jsonschema /usr/share/postgresql/18/extension/pg_jsonschema* /usr/share/postgresql/18/extension/
+RUN apt-get update \
+    && apt-get install -y --no-install-recommends postgresql-18-jsonschema \
+    && apt-get clean \
+    && rm -rf /var/lib/apt/lists/*

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions