This repository has been archived by the owner on Dec 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
42 lines (33 loc) · 1.75 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
FROM buildpack-deps:bionic-curl
MAINTAINER Inonit AS <[email protected]>
ENV PGBOUNCER_VERSION 1.13.0
ENV PGBOUNCER_TAR_URL http://www.pgbouncer.org/downloads/files/${PGBOUNCER_VERSION}/pgbouncer-${PGBOUNCER_VERSION}.tar.gz
ENV PGBOUNCER_SHA_URL ${PGBOUNCER_TAR_URL}.sha256
EXPOSE 6432
RUN groupadd -r pgbouncer
RUN useradd -rm -d /var/run/pgbouncer -s /usr/sbin/nologin -g pgbouncer pgbouncer
# Install build dependencies
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends build-essential libevent-dev libssl-dev libc-ares-dev pkg-config
RUN apt-get purge -y --auto-remove
RUN rm -rf /var/lib/apt/lists/*
# Download source code
RUN curl -SLO ${PGBOUNCER_TAR_URL} \
&& curl -SLO ${PGBOUNCER_SHA_URL} \
&& cat pgbouncer-${PGBOUNCER_VERSION}.tar.gz.sha256 | sha256sum -c - \
&& tar -zxf pgbouncer-${PGBOUNCER_VERSION}.tar.gz \
&& chown root:root pgbouncer-${PGBOUNCER_VERSION}
# Build PgBouncer source code
RUN cd pgbouncer-${PGBOUNCER_VERSION} \
&& ./configure --prefix=/usr/local \
--with-libevent=libevent-prefix \
--with-cares=cares-prefix \
--with-openssl=openssl-prefix \
&& make && make install
ADD pgbouncer /etc/pgbouncer
VOLUME /etc/pgbouncer
# Make sure pgbouncer user can read and write log files
RUN mkdir -p /var/log/pgbouncer && chown -R pgbouncer:pgbouncer /var/log/pgbouncer
USER pgbouncer
ENTRYPOINT ["pgbouncer"]
CMD ["/etc/pgbouncer/pgbouncer.ini"]