This repository has been archived by the owner on Aug 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
84 lines (70 loc) · 2.45 KB
/
Dockerfile
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
FROM ubuntu:16.04
ENV PGPOOL2_VERSION 3.7.1
ENV POSTGRESQL_VERSION 9.6
ENV LANG C.UTF-8
# Timezone
#-----------------------------------------------
ENV TIMEZONE Asia/Tokyo
RUN ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
# Library
#-----------------------------------------------
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
wget \
ca-certificates \
memcached \
&& rm -rf /var/lib/apt/lists/*
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/pgdg.list \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client-${POSTGRESQL_VERSION} \
libpq-dev \
postgresql-server-dev-${POSTGRESQL_VERSION} \
&& rm -rf /var/lib/apt/lists/*
# Download pgpool2
#-----------------------------------------------
RUN curl -L -o pgpool-II-${PGPOOL2_VERSION}.tar.gz http://www.pgpool.net/download.php?f=pgpool-II-${PGPOOL2_VERSION}.tar.gz \
&& tar zxvf pgpool-II-${PGPOOL2_VERSION}.tar.gz
# Build pgpool2
#-----------------------------------------------
WORKDIR /pgpool-II-${PGPOOL2_VERSION}
RUN buildDeps=' \
make \
g++ \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& ./configure \
&& make \
&& make install \
&& apt-get purge -y --auto-remove $buildDeps \
&& rm -rf /var/lib/apt/lists/*
# Build pgpool2 extensions for postgres
#-----------------------------------------------
WORKDIR /pgpool-II-${PGPOOL2_VERSION}/src/sql
RUN buildDeps=' \
make \
g++ \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& make \
&& make install \
&& apt-get purge -y --auto-remove $buildDeps \
&& rm -rf /var/lib/apt/lists/*
RUN ldconfig
# Clean up files
#-----------------------------------------------
RUN rm -rf /pgpool-II-${PGPOOL2_VERSION} & rm /pgpool-II-${PGPOOL2_VERSION}.tar.gz
# Expose pgpool port
#-----------------------------------------------
EXPOSE 9999
# Set up template of configuartion files
#-----------------------------------------------
RUN cp /usr/local/etc/pcp.conf.sample /usr/local/etc/pcp.conf
RUN cp /usr/local/etc/pgpool.conf.sample /usr/local/etc/pgpool.conf
RUN cp /usr/local/etc/pool_hba.conf.sample /usr/local/etc/pool_hba.conf
ENTRYPOINT ["pgpool"]
CMD ["-n"]