Skip to content

Commit b46014a

Browse files
committed
update go and public beta 18
1 parent 30df817 commit b46014a

File tree

3 files changed

+182
-142
lines changed

3 files changed

+182
-142
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11

22
# Define Default if Values not exist
3-
BASE_IMAGE ?= rockylinux:9
3+
BASE_IMAGE ?= rockylinux/rockylinux:9
44
BASEOS ?= rocky9
55
CONTAINERIMAGE ?= rockylinux/rockylinux:9-ubi-micro
66
IMAGE_REPOSITORY ?= docker.io
77
IMAGE_PATH ?= cybertec-pg-container
88
PGVERSION ?= 17
9-
PGVERSION_FULL ?= 17.4
9+
PGVERSION_FULL ?= 17.5
1010
OLD_PG_VERSIONS ?= 13 14 15 16
1111
PATRONI_VERSION ?= multisite-4.0.5.1
12-
PGBACKREST_VERSION ?= 2.55.0
12+
PGBACKREST_VERSION ?= 2.55.1
1313
POSTGIS_VERSION ?= 35
14-
ETCD_VERSION ?= 3.5.21
14+
ETCD_VERSION ?= 3.6.1
1515
PGBOUNCER_VERSION ?= 1.24
1616
PACKAGER ?= dnf
1717
BUILD ?= 1

docker/exporter/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN ${PACKAGER} -y install --nodocs \
1515
make \
1616
&& ${PACKAGER} -y clean all ;
1717

18-
RUN wget https://go.dev/dl/go1.23.6.linux-amd64.tar.gz && tar -xzf go1.23.6.linux-amd64.tar.gz && mv go /usr/local
18+
RUN wget https://go.dev/dl/go1.24.4.linux-amd64.tar.gz && tar -xzf go1.24.4.linux-amd64.tar.gz && mv go /usr/local
1919
ENV PATH=$PATH:/usr/local/go/bin
2020

2121
RUN git clone https://github.com/cybertec-postgresql/postgres_exporter.git && cd postgres_exporter && make build;
Lines changed: 177 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,203 @@
11
ARG IMAGE_PATH
22
ARG BUILD
33
ARG BASEOS
4-
ARG CONTAINERIMAGE
4+
ARG PGVERSION
55

6-
FROM ${IMAGE_PATH}/base:${BASEOS}-${BUILD} AS builder
6+
FROM ${IMAGE_PATH}/base:${BASEOS}-${BUILD} as builder
77

88
# Dockerfile specific informations
99
ARG PACKAGER
1010
ARG PGBACKREST_VERSION
11+
ARG PATRONI_VERSION
1112
ARG PGVERSION
1213
ARG OLD_PG_VERSIONS
14+
ARG PG_SUPPORTED_VERSIONS="$PGVERSION"
1315
ARG PG_SUPPORTED_VERSIONS="$OLD_PG_VERSIONS $PGVERSION"
16+
ARG ETCD_VERSION
17+
ARG ARCH
1418

1519
# Enable Beta-Repo
1620
RUN ${PACKAGER} config-manager --set-enabled pgdg${PGVERSION}-updates-testing \
17-
&& ${PACKAGER} config-manager --set-enabled pgdg${PGVERSION}-source-updates-testing \
18-
&& ${PACKAGER} -y update;
21+
&& ${PACKAGER} config-manager --set-enabled pgdg${PGVERSION}-source-updates-testing;
22+
23+
# Spilo-specific
24+
ENV PAM_OAUTH2=v1.0.1 \
25+
PG_PERMISSIONS=REL_1_3
1926

20-
RUN ${PACKAGER} -y install --nodocs \
27+
# Get some Standard-Stuff
28+
RUN ${PACKAGER} -y update && ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 \
2129
--setopt=skip_missing_names_on_install=False \
22-
openssh-clients \
23-
openssh-server \
24-
bzip2 \
25-
lz4 \
26-
zstd \
27-
libicu \
28-
dumb-init \
29-
jq \
30-
pgbackrest-${PGBACKREST_VERSION} \
31-
&& ${PACKAGER} -y clean all ;
32-
33-
# Install postgres-server
34-
RUN ${PACKAGER} -y update \
35-
&& for version in $PG_SUPPORTED_VERSIONS; do \
36-
${PACKAGER} -y install --nodocs postgresql${version}-server; \
30+
openssh-clients \
31+
openssh-server \
32+
shadow-utils \
33+
tar \
34+
bzip2 \
35+
lz4 \
36+
python3 \
37+
python3-pip \
38+
python3-psycopg2 \
39+
git \
40+
patchutils \
41+
binutils \
42+
make \
43+
cmake \
44+
gcc \
45+
clang \
46+
pam-devel \
47+
wget \
48+
mlocate \
49+
git-clang-format \
50+
openssl-devel \
51+
ccache \
52+
redhat-rpm-config \
53+
krb5-devel \
54+
busybox \
55+
jq \
56+
rsync \
57+
dumb-init \
58+
libicu \
59+
pgbackrest-${PGBACKREST_VERSION} \
60+
cronie \
61+
libcurl-devel \
62+
&& ${PACKAGER} -y clean all;
63+
64+
# install etcdctl
65+
RUN curl -L https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-${ARCH}.tar.gz | tar xz -C /bin --strip=1 --wildcards --no-anchored --no-same-owner etcdctl etcd;
66+
67+
ENV PATHBACKUP = $PATH
68+
69+
RUN wget https://smarden.org/runit/runit-2.1.2.tar.gz -P /package/
70+
COPY cron_unprivileged.c /package/
71+
72+
RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python-etcd psutil requests cdiff ydiff==1.4.2 --upgrade \
73+
&& if [[ $PATRONI_VERSION == "multisite-"* ]]; then \
74+
git clone -b $PATRONI_VERSION https://github.com/cybertec-postgresql/patroni; \
75+
pip3 install ./patroni[kubernetes,etcd,etcd3]; \
76+
else \
77+
pip3 install patroni[kubernetes$EXTRAS]==$PATRONI_VERSION --upgrade; \
78+
fi \
79+
&& mkdir /usr/lib/postgresql \
80+
# Install pam_oauth2.so
81+
&& git clone -b $PAM_OAUTH2 --recurse-submodules https://github.com/zalando-pg/pam-oauth2.git && make -C pam-oauth2 install \
82+
&& git clone -b $PG_PERMISSIONS https://github.com/cybertec-postgresql/pg_permissions.git \
83+
&& git clone https://github.com/dimitri/pgextwlist.git \
84+
&& git clone https://github.com/crunchydata/pgnodemx \
85+
\
86+
&& ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 postgresql${PGVERSION} libevent-devel brotli-devel libbrotli \
87+
&& ${PACKAGER} -y clean all \
88+
\
89+
# forbid creation of a main cluster when package is installed
90+
#&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
91+
\
92+
# Install PostgreSQL
93+
&& for version in $PG_SUPPORTED_VERSIONS; do \
94+
${PACKAGER} -y update && \
95+
${PACKAGER} -y install postgresql${version}-pltcl \
96+
pgaudit*${version} \
97+
credcheck_*${version} \
98+
# Install PostgreSQL binaries, contrib, plproxy and multiple pl's
99+
&& ${PACKAGER} -y install -y postgresql${version}-contrib \
100+
postgresql${version}-plpython3 postgresql${version}-devel \
101+
pg_cron_${version} pgvector_${version} set_user_${version} \
102+
# Modify for using origial-spilo scripts
103+
&& ln -s /usr/pgsql-${version} /usr/lib/postgresql/${version} \
104+
&& export PATH=$PATHBACKUP:/usr/pgsql-${version}/bin \
105+
# Install TimescaleDB
106+
&& ${PACKAGER} -y install timescaledb_${version} \
107+
&& cd / \
108+
&& for n in pg_permissions $EXTRA_EXTENSIONS; do \
109+
make -C $n USE_PGXS=1 clean install-strip; \
110+
done \
111+
&& cd /pgextwlist && make clean && make && make install \
112+
&& cd /pgnodemx && make USE_PGXS=1 clean && make USE_PGXS=1 && make USE_PGXS=1 install; \
37113
done \
38-
&& ${PACKAGER} -y clean all;
39-
40-
# Remove default pgbackrest-config
41-
RUN rm /etc/pgbackrest.conf
42-
RUN rm -rf /var/spool/pgbackrest
43-
44-
# Add kubectl
45-
RUN curl -LO https://dl.k8s.io/release/v1.30.0/bin/linux/amd64/kubectl && chmod +x kubectl
46-
47-
RUN mkdir -p /tmp/pgsql && cp -r /usr/pgsql* /tmp/pgsql
48-
RUN mkdir -p /tmp/pg && cp -r /usr/bin/pg* /tmp/pg
49-
RUN mkdir -p /tmp/lz4 && cp -r /usr/bin/lz4* /tmp/lz4
50-
RUN mkdir -p /tmp/zstd && cp -r /usr/bin/zstd* /tmp/zstd
51-
52-
53-
FROM ${CONTAINERIMAGE} as micro
54-
55-
ARG PGVERSION
56-
57-
COPY --from=builder /usr/bin/dumb-init /usr/bin/dumb-init
58-
COPY --from=builder /etc/passwd /etc/passwd
59-
COPY --from=builder /etc/group /etc/group
60-
COPY --from=builder /usr/lib64 /usr/lib64
61-
# SSH-client
62-
COPY --from=builder /etc/ssh /etc/ssh
63-
COPY --from=builder /usr/bin/ssh /usr/bin/ssh
64-
COPY --from=builder /usr/libexec/openssh /usr/libexec/openssh
65-
# pgBackRest
66-
COPY --from=builder /usr/bin/pgbackrest /usr/bin/pgbackrest
67-
COPY --from=builder /usr/share/licenses/pgbackrest/LICENSE /usr/share/licenses/pgbackrest/LICENSE
68-
COPY --from=builder /var/lib/pgbackrest /var/lib/pgbackrest
69-
COPY --from=builder /var/log/pgbackrest /var/log/pgbackrest
70-
# Postgres
71-
COPY --from=builder /tmp/pgsql/ /usr/
72-
COPY --from=builder /var/lib/pgsql /var/lib/pgsql
73-
COPY --from=builder /tmp/pg /usr/bin/
74-
75-
COPY --from=builder ./kubectl /usr/local/bin/
76-
# lz4
77-
COPY --from=builder /tmp/lz4 /usr/bin/
78-
# zstd
79-
COPY --from=builder /tmp/zstd /usr/bin/
80-
# Others
81-
COPY --from=builder /usr/bin/sed /usr/bin/sed
82-
COPY --from=builder /usr/bin/jq /usr/bin/jq
83-
COPY --from=builder /usr/bin/watch /usr/bin/watch
84-
COPY --from=builder /usr/share/locale /usr/share/locale
85-
COPY --from=builder /usr/lib /usr/lib
86-
COPY --from=builder /usr/lib64 /usr/lib64
87-
# CA
88-
COPY --from=builder /usr/bin/ca-legacy /usr/bin/ca-legacy
89-
COPY --from=builder /usr/bin/update-ca-trust /usr/bin/update-ca-trust
90-
# grep
91-
COPY --from=builder /etc/profile.d /etc/profile.d
92-
COPY --from=builder /usr/bin/grep /usr/bin/grep
93-
COPY --from=builder /usr/libexec /usr/libexec
94-
# COPY --from=builder /usr/bin/update-ca-trust /usr/bin/update-ca-trust
95-
# COPY --from=builder /usr/bin/update-ca-trust /usr/bin/update-ca-trust
96-
97-
# p11-kit
98-
COPY --from=builder /etc/pkcs11 /etc/pkcs11
99-
COPY --from=builder /usr/libexec/p11-kit /usr/libexec/p11-kit
100-
COPY --from=builder /usr/share/bash-completion/completions /usr/share/bash-completion/completions
101-
COPY --from=builder /usr/share/p11-kit /usr/share/p11-kit
102-
COPY --from=builder /usr/share/polkit-1 /usr/share/polkit-1
103-
104-
COPY --from=builder /usr/bin/p11-kit /usr/bin/p11-kit
105-
COPY --from=builder /etc/pki /etc/pki
106-
COPY --from=builder /usr/share/pki /usr/share/pki
107-
COPY --from=builder /etc/ssl /etc/ssl
108-
COPY --from=builder /etc/pkcs11 /etc/pkcs11
109-
110-
# p11-kit-trust
111-
COPY --from=builder /usr/bin/trust /usr/bin/
112-
113-
# libraries
114-
COPY --from=builder /usr/bin/nss_wrapper.pl /usr/bin/nss_wrapper.pl
115-
# COPY --from=builder /usr/lib64/libnss_wrapper.so /usr/lib64/libnss_wrapper.so
116-
COPY --from=builder /usr/share/man/man1 /usr/share/man/man1
117-
COPY --from=builder /usr/bin/envsubst /usr/bin/envsubst
118-
119-
RUN /usr/bin/update-ca-trust extract
120-
121-
# add postgres user and group
122-
#RUN groupadd postgres -g 26 && useradd postgres -u 26 -g 26
123-
124-
# Prepare all needed stuff
125-
Run mkdir -p /opt/pgbackrest /backrestrepo /home/postgres /home/postgres/pgdata/pgbackrest/log
126-
127-
# add pgbackrest-restore files
128-
ADD scripts/pgbackrest/ /opt/pgbackrest/bin/
129-
130-
# add pgbackrest-common files
131-
ADD /scripts/nss_wrapper /scripts/nss_wrapper
114+
&& ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 glibc-static \
115+
&& ${PACKAGER} -y clean all;
116+
RUN gcc -s -shared -fPIC -o /usr/local/lib/cron_unprivileged.so /package/cron_unprivileged.c
117+
118+
RUN cd /package && tar -xvzf runit-2.1.2.tar.gz && rm runit-2.1.2.tar.gz \
119+
&& cd admin/runit-2.1.2 && package/install \
120+
&& ln -s /usr/local/bin/runsvdir /usr/bin/runsvdir \
121+
&& rm -rf /pg_permissions /pgextwlist /pg_stat_kcache /pgnodemx /timescaledb /pam-oauth2 \
122+
&& rm /etc/pgbackrest.conf && rm -rf /var/spool/pgbackrest \
123+
&& ${PACKAGER} -y remove $(rpm -qa "*devel*") python3-pip python3-wheel python3-dev python3-setuptools git patchutils flatpak glibc-static gcc glibc-devel \
124+
&& ${PACKAGER} -y autoremove \
125+
&& ${PACKAGER} -y clean dbcache \
126+
&& ${PACKAGER} -y clean all;
132127

133128
FROM scratch
134-
COPY --from=micro / /
135129

136130
ARG PGVERSION
137131

138-
# set user and group ownership
139-
RUN chown -R postgres:postgres /opt/pgbackrest \
140-
/backrestrepo /home/postgres/pgdata/pgbackrest /home/postgres/pgdata
141-
142-
RUN mkdir -p /etc/pgbackrest \
143-
&& chown -R postgres:postgres /etc/pgbackrest
144-
145-
RUN chmod -R g=u /etc/pgbackrest \
146-
&& rm -f /run/nologin
147-
148-
RUN mkdir /.ssh && chown postgres:postgres /.ssh && chmod o+rwx /.ssh
149-
150-
# set user and group ownership
151-
RUN chown -R postgres:postgres /opt/pgbackrest \
152-
/backrestrepo /home/postgres/pgdata
153-
154-
#ENV PATH=$PATH:/usr/pgsql-$PGVERSION/bin
155-
COPY launcher/pgbackrest/launch.sh /
156-
157-
VOLUME ["sshd", "/home/postgres/pgdata", "/backrestrepo"]
132+
COPY --from=builder / /
133+
134+
EXPOSE 5432 8008 8080
135+
ENV LC_ALL=en_US.utf-8 \
136+
PATH=$PATH:/usr/pgsql-$PGVERSION/bin \
137+
PGHOME=/home/postgres \
138+
RW_DIR=/run \
139+
TIMESCALEDB=$TIMESCALEDB \
140+
DEMO=$DEMO
141+
142+
ENV LOG_ENV_DIR=$RW_DIR/etc/log.d/env \
143+
PGROOT=$PGHOME/pgdata/pgroot
144+
145+
ENV PGDATA=$PGROOT/data \
146+
PGLOG=$PGROOT/pg_log
147+
148+
WORKDIR $PGHOME
149+
150+
COPY motd /etc/
151+
#COPY runit /etc/service/
152+
153+
COPY runit /etc/runit/runsvdir/default/
154+
COPY pgq_ticker.ini $PGHOME/
155+
RUN rm -rf /etc/service && mkdir /home/postgres/pgdata && chown -R postgres:postgres /home/postgres/pgdata && chmod -R g=u /home/postgres/pgdata \
156+
&& sed -i "s|/var/lib/pgsql.*|$PGHOME:/bin/bash|" /etc/passwd \
157+
&& chown -R postgres:postgres $PGHOME $PGHOME/pgdata $RW_DIR \
158+
&& rm -fr /var/spool/cron /var/tmp \
159+
&& mkdir -p /var/spool \
160+
&& ln -s $RW_DIR/cron /var/spool/cron \
161+
&& ln -s $RW_DIR/tmp /var/tmp \
162+
&& for d in /etc/runit/runsvdir/default/*; do \
163+
chmod 755 $d/* \
164+
&& ln -s /run/supervise/$(basename $d) $d/supervise; \
165+
done \
166+
&& chmod +r /etc/motd \
167+
&& ln -snf $RW_DIR/service /etc/service \
168+
#&& ln -s $RW_DIR/pam.d-postgresql /etc/pam.d/postgresql \
169+
&& ln -s $RW_DIR/postgres.yml $PGHOME/postgres.yml \
170+
&& ln -s $RW_DIR/.bash_history /root/.bash_history \
171+
&& ln -s $RW_DIR/postgresql/.bash_history $PGHOME/.bash_history \
172+
&& ln -s $RW_DIR/postgresql/.psql_history $PGHOME/.psql_history \
173+
&& ln -s $RW_DIR/etc $PGHOME/etc \
174+
&& for d in $PGHOME /root; do \
175+
d=$d/.config/patroni \
176+
&& mkdir -p $d \
177+
&& ln -s $PGHOME/postgres.yml $d/patronictl.yaml; \
178+
done \
179+
&& sed -i 's/set compatible/set nocompatible/' /etc/vimrc \
180+
&& echo "PATH=\"$PATH\"" > /etc/environment \
181+
&& for e in TERM=linux LC_ALL=C.UTF-8 LANG=C.UTF-8 EDITOR=editor; \
182+
do echo "export $e" >> /etc/bash.bashrc; \
183+
done \
184+
&& ln -s /etc/skel/.bashrc $PGHOME/.bashrc \
185+
&& echo "source /etc/motd" >> /home/postgres/.bashrc \
186+
# Allow users in the root group to access the following files and dirs
187+
&& if [ "$COMPRESS" != "true" ]; then \
188+
chmod 664 /etc/passwd \
189+
&& chmod o+r /etc/shadow \
190+
&& chgrp -R 0 $PGHOME $RW_DIR \
191+
&& chmod -R g=u $PGHOME $RW_DIR \
192+
&& usermod -a -G root postgres; \
193+
fi
194+
195+
196+
COPY scripts bootstrap major_upgrade /scripts/
197+
COPY launcher/postgres/launch.sh /
158198

159199
ENTRYPOINT ["/scripts/nss_wrapper/nss_wrapper.sh"]
160200

161-
USER 26
201+
USER postgres
162202

163-
CMD ["dumb-init", "/launch.sh", "init"]
203+
CMD ["/bin/sh", "/launch.sh", "init"]

0 commit comments

Comments
 (0)