Use postgres:9.6 as a base image (#414)

* Expose 5000 and 5001 on corresponding ports
* Use latest version of etcd
This commit is contained in:
Alexander Kukushkin
2017-03-20 12:22:09 +01:00
committed by GitHub
parent 720d08d1b4
commit 5bd7d043ae
2 changed files with 12 additions and 27 deletions

View File

@@ -1,33 +1,19 @@
## This Dockerfile is meant to aid in the building and debugging patroni whilst developing on your local machine
## It has all the necessary components to play/debug with a single node appliance, running etcd
FROM ubuntu:16.04
FROM postgres:9.6
MAINTAINER Alexander Kukushkin <alexander.kukushkin@zalando.de>
RUN echo 'APT::Install-Recommends "0";' > /etc/apt/apt.conf.d/01norecommend \
&& echo 'APT::Install-Suggests "0";' >> /etc/apt/apt.conf.d/01norecommend
ENV PGVERSION 9.6
ENV PATH /usr/lib/postgresql/${PGVERSION}/bin:$PATH
RUN apt-get update -y \
RUN echo 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01norecommend \
&& apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y curl jq haproxy zookeeper python-psycopg2 python-yaml python-requests \
python-six python-click python-dateutil python-tzlocal python-urllib3 python-dnspython \
&& apt-get install -y curl jq haproxy python-psycopg2 python-yaml python-requests \
python-six python-dateutil python-urllib3 python-dnspython \
python-pip python-setuptools python-kazoo python-prettytable python-wheel python \
&& export DISTRIB_CODENAME=$(sed -n 's/DISTRIB_CODENAME=//p' /etc/lsb-release) \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ ${DISTRIB_CODENAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& echo "deb-src http://apt.postgresql.org/pub/repos/apt/ ${DISTRIB_CODENAME}-pgdg main" >> /etc/apt/sources.list.d/pgdg.list \
&& curl -s -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& pip install python-etcd==0.4.3 python-consul==0.7.0 click tzlocal --upgrade \
## 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 \
&& apt-get update -y \
&& apt-get install -y postgresql-contrib-${PGVERSION} \
# Remove the default cluster, which Debian stupidly starts right after installation of the packages
&& pg_dropcluster --stop ${PGVERSION} main \
&& pip install python-etcd==0.4.3 python-consul==0.6.1 --upgrade \
&& mkdir -p /home/postgres \
&& chown postgres:postgres /home/postgres \
# Clean up
&& apt-get remove -y python-pip python-setuptools \
@@ -35,7 +21,7 @@ RUN apt-get update -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /root/.cache
ENV ETCDVERSION 3.0.15
ENV ETCDVERSION 3.1.2
RUN curl -L https://github.com/coreos/etcd/releases/download/v${ETCDVERSION}/etcd-v${ETCDVERSION}-linux-amd64.tar.gz \
| tar xz -C /usr/local/bin --strip=1 --wildcards --no-anchored etcd etcdctl
@@ -50,8 +36,7 @@ RUN ln -s /patronictl.py /usr/local/bin/patronictl
### Setting up a simple script that will serve as an entrypoint
RUN mkdir /data/ && touch /pgpass /patroni.yml \
&& chown postgres:postgres -R /patroni/ /data/ /pgpass /patroni.yml /etc/haproxy /var/run/ /var/lib/ /var/log/ \
&& echo 1 > /etc/zookeeper/conf/myid
&& chown postgres:postgres -R /patroni/ /data/ /pgpass /patroni.yml /etc/haproxy /var/run/ /var/lib/ /var/log/
EXPOSE 2379 5432 8008

View File

@@ -50,8 +50,8 @@ haproxy:
links:
- patroni_etcd:patroni_etcd
ports:
- "5000"
- "5001"
- "5000:5000"
- "5001:5001"
environment:
PATRONI_ETCD_HOST: patroni_etcd:2379
PATRONI_SCOPE: testcluster