-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (42 loc) · 1.43 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (42 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Dockerfile
#
# Build a PostgreSQL image with:
# - pgenvelope C shim extension
# - rustcore Rust cdylib linked into the extension
# Change PG_MAJOR to desired major PostgreSQL version.
ARG PG_MAJOR=16
FROM postgres:${PG_MAJOR}
# Install build tools, PostgreSQL dev headers, and Rust toolchain
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
postgresql-server-dev-${PG_MAJOR} \
curl \
pkg-config \
libssl-dev \
softhsm2 \
opensc \
rustc \
cargo \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Build the Rust core (rustcore)
# Assumes repo layout:
# /usr/src/pgenvelope/rustcore/
COPY rustcore/ /usr/src/pgenvelope/rustcore/
WORKDIR /usr/src/pgenvelope/rustcore
RUN cargo build --release
# Build and install the C shim, linking against the Rust core
# Assumes:
# cshim/Makefile (with SHLIB_LINK to ../rustcore/target/release)
# cshim/pgenvelope.c
# cshim/pgenvelope.control
# cshim/pgenvelope--1.0.sql
COPY cshim/ /usr/src/pgenvelope/cshim/
WORKDIR /usr/src/pgenvelope/cshim
RUN make && make install && \
# Ensure the Rust core library is available in Postgres's libdir at runtime
cp ../rustcore/target/release/libpgenvelope_core.so "$(pg_config --libdir)"/ && \
# Optional: cleanup build sources to keep image smaller
rm -rf /usr/src/pgenvelope
# CMD and entrypoint inherited from postgres:16