-
Notifications
You must be signed in to change notification settings - Fork 231
/
Dockerfile
65 lines (53 loc) · 2.46 KB
/
Dockerfile
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM postgres:9.6-bullseye AS build
ARG USE_POSTGIS=true
ENV PLUGIN_VERSION=v3.0.6.Final
ENV PROTOC_VERSION=1.4
ENV WAL2JSON_COMMIT_ID=92b33c7d7c2fccbeb9f79455dafbc92e87e00ddd
# Install the packages which will be required to get everything to compile
RUN apt-get update \
&& apt-get install -f -y --no-install-recommends \
software-properties-common \
build-essential \
pkg-config \
git \
clang-11 \
llvm-11 \
postgresql-server-dev-$PG_MAJOR \
&& add-apt-repository "deb http://ftp.debian.org/debian testing main contrib" \
&& apt-get update && apt-get install -f -y --no-install-recommends \
libprotobuf-c-dev=$PROTOC_VERSION.* \
&& rm -rf /var/lib/apt/lists/*
# Compile the plugin from sources and install it
RUN git clone https://github.com/debezium/postgres-decoderbufs -b $PLUGIN_VERSION --single-branch \
&& cd /postgres-decoderbufs \
&& make && make install \
&& cd / \
&& rm -rf postgres-decoderbufs
RUN git clone https://github.com/eulerto/wal2json -b master --single-branch \
&& cd /wal2json \
&& git checkout $WAL2JSON_COMMIT_ID \
&& make && make install \
&& cd / \
&& rm -rf wal2json
FROM postgres:9.6-bullseye
LABEL maintainer="Debezium Community"
ENV POSTGIS_VERSION=3
RUN apt-get update \
&& apt-get install -f -y --no-install-recommends \
software-properties-common \
&& if [ "$USE_POSTGIS" != "false" ]; then apt-get install -f -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_VERSION-scripts \
postgis; \
fi \
&& add-apt-repository "deb http://ftp.debian.org/debian testing main contrib" \
&& apt-get update && apt-get install -f -y --no-install-recommends \
libprotobuf-c1 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /usr/lib/postgresql/$PG_MAJOR/lib/decoderbufs.so /usr/lib/postgresql/$PG_MAJOR/lib/wal2json.so /usr/lib/postgresql/$PG_MAJOR/lib/
COPY --from=build /usr/share/postgresql/$PG_MAJOR/extension/decoderbufs.control /usr/share/postgresql/$PG_MAJOR/extension/
# Copy the custom configuration which will be passed down to the server (using a .sample file is the preferred way of doing it by
# the base Docker image)
COPY postgresql.conf.sample /usr/share/postgresql/postgresql.conf.sample
# Copy the script which will initialize the replication permissions
COPY /docker-entrypoint-initdb.d /docker-entrypoint-initdb.d