mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-01-28 02:20:04 +00:00
- Update postgres docker image to the latest 11 version. - Remove empty lines inside the `RUN` command to make the Dockerfile compatible with future docker versions. - Set the `PATRONI_KUBERNETES_POD_IP` environment variable, which is required when _use_endpoints_ is enabled. Otherwise, the `KeyError` is raised [here](https://github.com/zalando/patroni/blob/master/patroni/dcs/kubernetes.py#L95). - Set `EDITOR` environment variable to make configuration changes via `patronictl edit-config`.
35 lines
1.4 KiB
Docker
35 lines
1.4 KiB
Docker
FROM postgres:11
|
|
MAINTAINER Alexander Kukushkin <alexander.kukushkin@zalando.de>
|
|
|
|
RUN export DEBIAN_FRONTEND=noninteractive \
|
|
&& echo 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01norecommend \
|
|
&& apt-get update -y \
|
|
&& apt-get upgrade -y \
|
|
&& apt-cache depends patroni | sed -n -e 's/.* Depends: \(python3-.\+\)$/\1/p' \
|
|
| grep -Ev '^python3-(sphinx|etcd|consul|kazoo|kubernetes)' \
|
|
| xargs apt-get install -y vim-tiny curl jq locales git python3-pip python3-wheel \
|
|
## Make sure we have a en_US.UTF-8 locale available
|
|
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
|
|
&& pip3 install setuptools \
|
|
&& pip3 install 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \
|
|
&& PGHOME=/home/postgres \
|
|
&& mkdir -p $PGHOME \
|
|
&& chown postgres $PGHOME \
|
|
&& sed -i "s|/var/lib/postgresql.*|$PGHOME:/bin/bash|" /etc/passwd \
|
|
# Set permissions for OpenShift
|
|
&& chmod 775 $PGHOME \
|
|
&& chmod 664 /etc/passwd \
|
|
# Clean up
|
|
&& apt-get remove -y git python3-pip python3-wheel \
|
|
&& apt-get autoremove -y \
|
|
&& apt-get clean -y \
|
|
&& rm -rf /var/lib/apt/lists/* /root/.cache
|
|
|
|
ADD entrypoint.sh /
|
|
|
|
EXPOSE 5432 8008
|
|
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 EDITOR=/usr/bin/editor
|
|
USER postgres
|
|
WORKDIR /home/postgres
|
|
CMD ["/bin/bash", "/entrypoint.sh"]
|