-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
61 lines (50 loc) · 1.92 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
# vim:set ft=dockerfile:
#
# Based on official postgres and cloudnative-pg containers
#
FROM --platform=${BUILDPLATFORM:-linux/amd64} postgres:15.3 as build
ARG BUILDPLATFORM
RUN apt-get update && apt-get -y install \
git make gcc \
postgresql-server-dev-15 \
librdkafka-dev \
zlib1g-dev && \
git clone https://github.com/adjust/kafka_fdw.git
RUN cd kafka_fdw && make && make install
FROM --platform=${BUILDPLATFORM:-linux/amd64} postgres:15.3
ARG BUILDPLATFORM
# Do not split the description, otherwise we will see a blank space in the labels
LABEL name="PostgreSQL Container Images with Kafka FWD" \
vendor="Digitalis.IO" \
version="${PG_VERSION}" \
summary="PostgreSQL Container images." \
description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 15.3."
LABEL org.opencontainers.image.description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 15.3-debian."
COPY requirements.txt /
# Install additional extensions
RUN set -xe; \
apt-get update; \
apt-get install -y --no-install-recommends \
"postgresql-${PG_MAJOR}-pgaudit" \
"postgresql-${PG_MAJOR}-pg-failover-slots" \
librdkafka1 librdkafka++1 \
; \
rm -fr /tmp/* ; \
rm -rf /var/lib/apt/lists/*;
# Install barman-cloud
RUN set -xe; \
apt-get update; \
apt-get install -y --no-install-recommends \
python3-pip \
python3-psycopg2 \
python3-setuptools \
; \
pip3 install --upgrade pip --break-system-packages; \
pip3 install --no-deps -r requirements.txt --break-system-packages; \
rm -rf /var/lib/apt/lists/*;
COPY --from=build /usr/lib/postgresql/15/lib/bitcode/kafka_fdw /usr/lib/postgresql/15/lib/bitcode/kafka_fdw
COPY --from=build /usr/share/postgresql/15/extension/kafka* /usr/share/postgresql/15/extension/
COPY --from=build /usr/lib/postgresql/15/lib/kafka_fdw.so /usr/lib/postgresql/15/lib/kafka_fdw.so
# Change the uid of postgres to 26
RUN usermod -u 26 postgres
USER 26