forked from manuc66/pgpool2-container
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (54 loc) · 2.13 KB
/
Dockerfile
File metadata and controls
59 lines (54 loc) · 2.13 KB
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
##### gosu
FROM alpine:3.6 as gosu
ENV GOSU_VERSION 1.10
RUN set -ex; \
\
apk add --no-cache --virtual .gosu-deps \
dpkg \
gnupg \
openssl \
; \
\
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
chmod +x /usr/local/bin/gosu; \
gosu nobody true; \
apk del .gosu-deps
##### pgpool2
FROM alpine:3.6
ENV PGPOOL_VERSION 3.7.0
ENV PG_VERSION 9.6.6-r0
ENV LANG en_US.utf8
COPY --from=gosu /usr/local/bin/gosu /usr/local/bin/gosu
RUN apk --update --no-cache --virtual .build-deps add \
postgresql-dev=${PG_VERSION} linux-headers gcc make libgcc g++ libmemcached-dev cyrus-sasl-dev && \
apk --update --no-cache add libpq=${PG_VERSION} postgresql-client=${PG_VERSION} libmemcached-libs \
libffi-dev python python-dev py2-pip && \
cd /tmp && \
wget http://www.pgpool.net/mediawiki/images/pgpool-II-${PGPOOL_VERSION}.tar.gz -O - | tar -xz && \
chown root:root -R /tmp/pgpool-II-${PGPOOL_VERSION} && \
cd /tmp/pgpool-II-${PGPOOL_VERSION} && \
./configure --prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--with-memcached=/usr && \
make && \
make install && \
rm -rf /tmp/pgpool-II-${PGPOOL_VERSION} && \
cd /tmp && \
apk del .build-deps && \
pip install Jinja2 && \
mkdir /etc/pgpool2 /var/run/pgpool /var/log/pgpool /var/run/postgresql /var/log/postgresql/ && \
chown postgres /etc/pgpool2 /var/run/pgpool /var/log/pgpool /var/run/postgresql /var/log/postgresql
# Post Install Configuration.
ADD bin/configure-pgpool2 /usr/bin/configure-pgpool2
RUN chmod +x /usr/bin/configure-pgpool2
ADD conf/pcp.conf.template /usr/share/pgpool2/pcp.conf.template
ADD conf/pgpool.conf.template /usr/share/pgpool2/pgpool.conf.template
# Start the container.
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 9999 9898
CMD ["pgpool","-n", "-f", "/etc/pgpool2/pgpool.conf", "-F", "/etc/pgpool2/pcp.conf"]