Skip to content

Commit

Permalink
Update dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
craigpastro committed Dec 2, 2023
1 parent dfdb217 commit 1310fb1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .ci/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ services:
context: ..
environment:
USER: postgres
command: [ "cargo", "pgrx", "test", "pg16" ]
command: [ "cargo", "pgrx", "test", "pg15" ]
18 changes: 12 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Based off of https://github.com/tembo-io/pgmq/blob/main/images/pgmq-pg/Dockerfile
FROM postgres:16-bookworm as build
ARG PG_MAJOR_VERSION=15

FROM postgres:${PG_MAJOR_VERSION}-bookworm as build

ARG PG_MAJOR_VERSION=15

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
Expand All @@ -9,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libssl-dev \
pkg-config \
postgresql-server-dev-16 \
postgresql-server-dev-${PG_MAJOR_VERSION} \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -19,16 +23,18 @@ RUN $HOME/.cargo/bin/rustup default stable

# Install pgrx
RUN $HOME/.cargo/bin/cargo install --locked --version 0.11.0 cargo-pgrx
RUN $HOME/.cargo/bin/cargo pgrx init --pg16 $(which pg_config)
RUN $HOME/.cargo/bin/cargo pgrx init --pg${PG_MAJOR_VERSION} $(which pg_config)

# Install pg_uuidv7
COPY . .
RUN $HOME/.cargo/bin/cargo pgrx install -c $(which pg_config)

FROM postgres:16-bookworm
FROM postgres:${PG_MAJOR_VERSION}-bookworm

ARG PG_MAJOR_VERSION=15

COPY --from=build /usr/share/postgresql/16/extension /usr/share/postgresql/16/extension
COPY --from=build /usr/share/postgresql/16/lib /usr/share/postgresql/16/lib
COPY --from=build /usr/share/postgresql/${PG_MAJOR_VERSION}/extension /usr/share/postgresql/${PG_MAJOR_VERSION}/extension
COPY --from=build /usr/lib/postgresql/${PG_MAJOR_VERSION}/lib /usr/lib/postgresql/${PG_MAJOR_VERSION}/lib

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ should drop you into a psql prompt:
psql (16.0)
Type "help" for help.
pg_uuidv7=# create extension pg_uuidv7;
pg_uuidv7=# CREATE EXTENSION pg_uuidv7;
CREATE EXTENSION
pg_uuidv7=# select uuid_generate_v7();
pg_uuidv7=# SELECT uuid_generate_v7();
uuid_generate_v7
--------------------------------------
01890414-ce5e-7de1-bafe-3dfc8338fb1c
Expand Down

0 comments on commit 1310fb1

Please sign in to comment.