# PostgreSQL image with pg_synonym preinstalled.
#
#   docker build -t pg_synonym .
#   docker build --build-arg PG_MAJOR=18 -t pg_synonym:18 .
#   docker run -d --name pgsyn -e POSTGRES_PASSWORD=postgres -p 5432:5432 pg_synonym
#   docker exec -it pgsyn psql -U postgres -c "CREATE EXTENSION pg_synonym"

ARG PG_MAJOR=17
FROM postgres:${PG_MAJOR}
ARG PG_MAJOR

RUN apt-get update \
 && apt-get install -y --no-install-recommends build-essential postgresql-server-dev-${PG_MAJOR} \
 && rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/pg_synonym
COPY . .
RUN make with_llvm=no clean \
 && make with_llvm=no \
 && make with_llvm=no install
