Skip to content

Commit e1d9d80

Browse files
authored
Update Dockerfile
1 parent 4d0260f commit e1d9d80

File tree

1 file changed

+41
-9
lines changed

1 file changed

+41
-9
lines changed

Dockerfile

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,47 @@
1-
# syntax=docker/dockerfile:1.4
1+
#https://github.com/supabase/pg_jsonschema/blob/master/dockerfiles/db/Dockerfile
2+
FROM postgres:16 as base
3+
RUN apt-get update
24

3-
FROM alpine:3.19 AS downloader
4-
RUN apk add --no-cache git
5-
RUN git clone https://github.com/supabase/pg_jsonschema.git
6-
WORKDIR /pg_jsonschema
7-
RUN ln -s dockerfiles/db/Dockerfile Dockerfile.pg_jsonschema
5+
ENV build_deps ca-certificates \
6+
git \
7+
build-essential \
8+
libpq-dev \
9+
postgresql-server-dev-16 \
10+
curl \
11+
libreadline6-dev \
12+
zlib1g-dev
813

9-
FROM scratch AS pg_jsonschema
10-
COPY --from=downloader /pg_jsonschema /
1114

12-
FROM pg_jsonschema AS base
15+
RUN apt-get install -y --no-install-recommends $build_deps pkg-config cmake
16+
17+
WORKDIR /home/supa
18+
19+
ENV HOME=/home/supa \
20+
PATH=/home/supa/.cargo/bin:$PATH
21+
RUN chown postgres:postgres /home/supa
22+
USER postgres
23+
24+
RUN \
25+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain stable && \
26+
rustup --version && \
27+
rustc --version && \
28+
cargo --version
29+
30+
# PGX
31+
RUN cargo install cargo-pgrx --version 0.12.6 --locked
32+
33+
RUN cargo pgrx init --pg16 $(which pg_config)
34+
35+
USER root
36+
37+
COPY . .
38+
RUN cargo pgrx install
39+
40+
RUN chown -R postgres:postgres /home/supa
41+
RUN chown -R postgres:postgres /usr/share/postgresql/16/extension
42+
RUN chown -R postgres:postgres /usr/lib/postgresql/16/lib
43+
44+
USER postgres
1345

1446
# Script to detect whether the database has finished initializing
1547
COPY ["true_isready.sh", "/usr/local/bin/"]

0 commit comments

Comments
 (0)