From 8f541d282814cfda217bbe1e478c8a18133744e1 Mon Sep 17 00:00:00 2001
From: Wonderfall <wonderfall@schrodinger.io>
Date: Thu, 20 Apr 2017 03:35:28 +0200
Subject: [PATCH] add pgbouncer image

---
 pgbouncer/Dockerfile | 15 +++++++++++++++
 pgbouncer/run.sh     |  4 ++++
 2 files changed, 19 insertions(+)
 create mode 100644 pgbouncer/Dockerfile
 create mode 100644 pgbouncer/run.sh

diff --git a/pgbouncer/Dockerfile b/pgbouncer/Dockerfile
new file mode 100644
index 0000000..3e86d2b
--- /dev/null
+++ b/pgbouncer/Dockerfile
@@ -0,0 +1,15 @@
+FROM alpine:edge
+
+ENV UID=991 GID=991
+
+RUN echo "@testing https://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
+ && apk -U add pgbouncer@testing tini su-exec \
+ && rm -rf /var/cache/apk/*
+
+COPY run.sh /usr/local/bin/run.sh
+
+RUN chmod +x /usr/local/bin/run.sh
+
+VOLUME /config
+
+CMD ["/sbin/tini","--","run.sh"]
diff --git a/pgbouncer/run.sh b/pgbouncer/run.sh
new file mode 100644
index 0000000..9fe174e
--- /dev/null
+++ b/pgbouncer/run.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+mkdir /run/pgbouncer
+chown -R $UID:$GID /etc/pgbouncer /var/log/pgbouncer /run/pgbouncer
+su-exec $UID:$GID pgbouncer /etc/pgbouncer/pgbouncer.ini