Files
postgresrepmgr/Dockerfile

34 lines
1.2 KiB
Docker
Raw Normal View History

2026-02-20 09:50:23 +01:00
FROM postgres:15
2026-02-18 10:24:06 +01:00
2026-02-20 09:50:23 +01:00
RUN apt-get update && \
apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-repmgr \
&& \
rm -rf /var/lib/apt/lists/*
2026-02-18 10:24:06 +01:00
2026-02-23 11:29:43 +01:00
RUN install --verbose --directory --owner postgres --group postgres --mode 1777 /etc/repmgr && \
ln -s /etc/repmgr/repmgr.conf /etc/repmgr.conf
2026-02-20 15:07:41 +01:00
VOLUME /etc/repmgr
2026-02-23 09:33:59 +01:00
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openssh-server \
2026-02-23 11:12:13 +01:00
sudo \
&& \
2026-02-23 09:39:03 +01:00
rm -rf /var/lib/apt/lists/* && \
2026-02-23 11:12:13 +01:00
echo "postgres ALL = (ALL) NOPASSWD:ALL" >> /etc/sudoers && \
echo "X11Forwarding no" >> /etc/ssh/sshd_config && \
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config && \
echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config && \
2026-02-23 09:39:03 +01:00
mkdir -p /var/lib/postgresql/.ssh && \
chmod 700 /var/lib/postgresql/.ssh && \
2026-02-23 11:12:13 +01:00
chown postgres: /var/lib/postgresql/.ssh && \
chmod g-w,o-w /var/lib/postgresql
2026-02-24 10:04:32 +01:00
COPY --chmod=600 --chown=postgres:postgres authorized_keys id_ed25519 /var/lib/postgresql/.ssh/
2026-02-23 09:33:59 +01:00
2026-02-24 10:04:32 +01:00
COPY --chmod=644 --chown=postgres:postgres profile /var/lib/postgresql/.profile
2026-02-20 17:51:31 +01:00
COPY --chmod=755 entrypoint.sh /usr/local/bin/
ENTRYPOINT ["entrypoint.sh"]