mirror of
https://github.com/ahmadk953/poixpixel-discord-bot.git
synced 2025-06-22 06:04:20 +00:00
feat: add pgbouncer
This commit is contained in:
parent
984e495d03
commit
ca24d57fd0
8 changed files with 438 additions and 15 deletions
42
docker/pgbouncer/Dockerfile
Normal file
42
docker/pgbouncer/Dockerfile
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Based on https://raw.githubusercontent.com/edoburu/docker-pgbouncer/master/Dockerfile
|
||||
|
||||
FROM alpine:3.22 AS build
|
||||
|
||||
LABEL org.opencontainers.image.source=https://github.com/ahmadk953/poixpixel-discord-bot/tree/main/docker/pgbouncer
|
||||
LABEL org.opencontainers.image.description="Docker image for pgbouncer with c-ares support"
|
||||
LABEL org.opencontainers.image.licenses=Apache-2.0
|
||||
|
||||
ARG PGBOUNCER_VERSION=1.24.1
|
||||
ARG C_ARES_VERSION=1.34.5
|
||||
|
||||
RUN apk add --no-cache autoconf autoconf-doc automake curl gcc git libc-dev libevent-dev libtool make openssl-dev pandoc pkgconfig
|
||||
|
||||
RUN curl -Lo /c-ares.tar.gz https://github.com/c-ares/c-ares/releases/download/v${C_ARES_VERSION}/c-ares-${C_ARES_VERSION}.tar.gz && \
|
||||
tar -xzf /c-ares.tar.gz && mv /c-ares-${C_ARES_VERSION} /c-ares
|
||||
|
||||
RUN curl -Lo /pgbouncer.tar.gz https://pgbouncer.github.io/downloads/files/${PGBOUNCER_VERSION}/pgbouncer-${PGBOUNCER_VERSION}.tar.gz && \
|
||||
tar -xzf /pgbouncer.tar.gz && mv /pgbouncer-${PGBOUNCER_VERSION} /pgbouncer
|
||||
|
||||
RUN cd /c-ares && ./configure && make && make install
|
||||
RUN cd /pgbouncer && ./configure --with-cares && make && make install
|
||||
|
||||
FROM alpine:3.22
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
RUN apk add --no-cache busybox libevent postgresql-client \
|
||||
&& mkdir -p /etc/pgbouncer /var/log/pgbouncer /var/run/pgbouncer \
|
||||
&& touch /etc/pgbouncer/userlist.txt \
|
||||
&& addgroup -S -g 1100 pgbouncer \
|
||||
&& adduser -S -u 1100 -G pgbouncer pgbouncer \
|
||||
&& chown -R pgbouncer:pgbouncer /etc/pgbouncer /var/log/pgbouncer /var/run/pgbouncer /entrypoint.sh \
|
||||
&& chmod +x /entrypoint.sh
|
||||
|
||||
COPY --from=build /usr/local/bin /usr/local/bin
|
||||
COPY --from=build /usr/local/lib /usr/local/lib
|
||||
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 pgbouncer
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["/usr/local/bin/pgbouncer", "/etc/pgbouncer/pgbouncer.ini"]
|
Loading…
Add table
Add a link
Reference in a new issue