OP#213 Dockerfile

This commit is contained in:
12ww1160
2025-12-06 12:34:43 +01:00
parent c5baaf9dca
commit 02a2e81ff0
2 changed files with 40 additions and 1 deletions

View File

@@ -0,0 +1,39 @@
FROM debian:stable-slim
LABEL maintainer="12ww1160@confdroid.com"
ENV PGBOUNCER_VERSION=1.22.1
# Ensure tzdata is installed without prompts
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
echo "tzdata tzdata/Areas select Etc" | debconf-set-selections && \
echo "tzdata tzdata/Zones/Etc select UTC" | debconf-set-selections && \
apt-get install -y --no-install-recommends \
pgbouncer \
ca-certificates \
tzdata \
netcat-openbsd \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN groupadd -r pgbouncer && \
useradd -r -g pgbouncer -d /etc/pgbouncer -s /usr/sbin/nologin pgbouncer
# Directories
RUN mkdir -p /etc/pgbouncer /etc/pgbouncer/tls
RUN chown -R pgbouncer:pgbouncer /etc/pgbouncer && \
chmod 700 /etc/pgbouncer && \
chmod 700 /etc/pgbouncer/tls
# Drop privileges
USER pgbouncer
EXPOSE 6432
# Healthcheck
HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD \
pg_isready -h 127.0.0.1 -p 6432 || exit 1
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["pgbouncer", "/etc/pgbouncer/pgbouncer.ini"]

View File

@@ -6,4 +6,4 @@
`Pgbouncer` is a loadbalancer for postgresql connections and very helpful in managing aspects of postgresql performance. `Pgbouncer` is a loadbalancer for postgresql connections and very helpful in managing aspects of postgresql performance.
`confdroid_pgbouncer`is a standalone container suitable for running on docker, kubernetes etc to facilitate loadbalancer deployments. `confdroid_pgbouncer`is a standalone container suitable for running on kubernetes etc to facilitate loadbalancer deployments.