File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -36,12 +36,27 @@ RUN apt-get update \
3636RUN curl -L -o /usr/local/bin/confd https://github.com/kelseyhightower/confd/releases/download/v${CONFD_VERSION}/confd-${CONFD_VERSION}-linux-amd64 \
3737 && chmod +x /usr/local/bin/confd
3838
39+ # Install Gosu
40+ ENV GOSU_VERSION 1.9
41+ RUN set -x \
42+ && apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
43+ && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
44+ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
45+ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
46+ && export GNUPGHOME="$(mktemp -d)" \
47+ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
48+ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
49+ && rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
50+ && chmod +x /usr/local/bin/gosu \
51+ && gosu nobody true \
52+ && rm -rf /var/lib/apt/lists/*
53+
3954COPY conf.d /etc/confd/conf.d
4055COPY templates /etc/confd/templates
4156
42- RUN mkdir -p /home/postgres/restore && chown -R postgres /home/postgres
4357COPY /docker-entrypoint.sh /
44- USER postgres
4558WORKDIR /home/postgres
4659
60+ VOLUME [ "/home/postgres/pghoard" ]
61+
4762ENTRYPOINT ["/docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change 22
33set -e
44
5+ echo " Fix permissions"
6+ mkdir -p /home/postgres/restore
7+ chown -R postgres /home/postgres
8+
59echo " Create physical_replication_slot on master ..."
610export PGPASSWORD=$PG_PASSWORD
711until psql -qAt -U replicator -h $PG_HOST -d postgres -c " select user;" ; do
@@ -21,4 +25,4 @@ echo "Dump configuration..."
2125cat /home/postgres/pghoard.json
2226
2327echo " Run the pghoard daemon ..."
24- exec pghoard --short-log --config /home/postgres/pghoard.json
28+ exec gosu postgres pghoard --short-log --config /home/postgres/pghoard.json
You can’t perform that action at this time.
0 commit comments