-
Notifications
You must be signed in to change notification settings - Fork 291
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (22 loc) · 1.17 KB
/
Dockerfile
File metadata and controls
28 lines (22 loc) · 1.17 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
FROM alpine:3.22 AS build
ARG VERSION=1.25.1
# Inspiration from https://github.com/gmr/alpine-pgbouncer/blob/master/Dockerfile
# hadolint ignore=DL3003,DL3018
RUN apk add --no-cache autoconf automake curl gcc libc-dev libevent-dev libtool make openssl-dev pkgconfig
# build version for release
RUN curl -sS -o /pgbouncer.tar.gz -L https://pgbouncer.github.io/downloads/files/$VERSION/pgbouncer-$VERSION.tar.gz && \
tar -xzf /pgbouncer.tar.gz && mv /pgbouncer-$VERSION /pgbouncer
RUN cd /pgbouncer && ./configure --prefix=/usr && make -j$(nproc) pgbouncer && strip pgbouncer
FROM alpine:3.22
RUN apk add --no-cache libevent postgresql-client && \
mkdir -p /etc/pgbouncer /var/log/pgbouncer /var/run/pgbouncer && \
touch /etc/pgbouncer/userlist.txt && \
chown -R postgres /var/log/pgbouncer /var/run/pgbouncer /etc/pgbouncer
COPY entrypoint.sh /entrypoint.sh
COPY --from=build /pgbouncer/pgbouncer /usr/bin
COPY --from=build /pgbouncer/etc/pgbouncer.ini /etc/pgbouncer/pgbouncer.ini.example
COPY --from=build /pgbouncer/etc/userlist.txt /etc/pgbouncer/userlist.txt.example
EXPOSE 5432
USER postgres
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/bin/pgbouncer", "/etc/pgbouncer/pgbouncer.ini"]