File tree Expand file tree Collapse file tree
charts/database/templates
docker-entrypoint-initdb.d Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- FROM minio/mc:latest as mc
1+ FROM docker.io/ minio/mc:latest as mc
22
33
4- FROM golang:latest as builder
4+ FROM docker.io/library/ golang:latest as builder
55ARG GOBIN=/usr/local/bin
6- ARG WAL_G_VERSION=v0.2.15
6+ ARG WAL_G_VERSION=v0.2.19
77
88RUN apt-get update \
99 && apt-get install -y git gcc liblzo2-dev cmake \
1010 && git clone --dept 1 -b $WAL_G_VERSION https://github.com/wal-g/wal-g $GOPATH/src/github.com/wal-g/wal-g \
1111 && cd $GOPATH/src/github.com/wal-g/wal-g \
1212 && make install \
1313 && make deps \
14- && CGO_ENABLE=0 make pg_install
14+ && make pg_install
1515
1616
17- FROM postgres:13-alpine
17+ FROM docker.io/library/ postgres:13
1818
1919COPY rootfs /
2020COPY --from=mc /usr/bin/mc /bin/mc
@@ -24,10 +24,12 @@ ENV PGDATA $PGDATA/$PG_MAJOR
2424ENV WALG_ENVDIR /etc/wal-g.d/env
2525
2626RUN mkdir -p $WALG_ENVDIR \
27- && apk add --no-cache jq python3 curl \
28- && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
29- && python3 get-pip.py \
30- && rm -rf get-pip.py \
27+ && apt-get update \
28+ && apt-get install -y --no-install-recommends \
29+ jq \
30+ python3 \
31+ ca-certificates \
32+ python3-pip \
3133 && pip3 install envdir
3234
3335CMD ["/docker-entrypoint.sh" , "postgres" ]
Original file line number Diff line number Diff line change 4545 preStop :
4646 exec :
4747 command :
48- - su-exec
48+ - gosu
4949 - postgres
5050 - do_backup
5151 readinessProbe :
Original file line number Diff line number Diff line change @@ -8,4 +8,4 @@ if [[ -f "$PGDATA/recovery.signal" ]]; then
88 exit 1
99fi
1010
11- su-exec postgres pg_ctl status
11+ gosu postgres pg_ctl status
Original file line number Diff line number Diff line change 66if [[ $( envdir " $WALG_ENVDIR " wal-g backup-list | wc -l) -gt " 1" ]]; then
77 echo " Found backups. Restoring from backup..."
88 {
9- su-exec postgres pg_ctl -D " $PGDATA " -w stop > /dev/null 2>&1
9+ gosu postgres pg_ctl -D " $PGDATA " -w stop > /dev/null 2>&1
1010 } || {
1111 echo " ignore script errors"
1212 }
4343 touch " $PGDATA /recovery.signal"
4444 chown -R postgres:postgres " $PGDATA "
4545 chmod 0700 " $PGDATA "
46- su-exec postgres pg_ctl -D " $PGDATA " \
46+ gosu postgres pg_ctl -D " $PGDATA " \
4747 -o " -c listen_addresses=''" \
4848 -w start
4949else
6161
6262 # reboot the server for wal_level to be set before backing up
6363 echo " Rebooting postgres to enable archive mode"
64- su-exec postgres pg_ctl -D " $PGDATA " -w restart
64+ gosu postgres pg_ctl -D " $PGDATA " -w restart
6565fi
6666
6767# ensure $PGDATA has the right permissions
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33# Run periodic backups in the background
4- su-exec postgres backup &
4+ gosu postgres backup &
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ if [ "$1" = 'postgres' ]; then
2323
2424 # look specifically for PG_VERSION, as it is expected in the DB dir
2525 if [ ! -s " $PGDATA /PG_VERSION" ]; then
26- su-exec postgres initdb
26+ gosu postgres initdb
2727
2828 # check password first so we can output the warning before postgres
2929 # messes it up
@@ -54,7 +54,7 @@ if [ "$1" = 'postgres' ]; then
5454
5555 # internal start of server in order to allow set-up using psql-client
5656 # does not listen on TCP/IP and waits until start finishes
57- su-exec postgres pg_ctl -D " $PGDATA " \
57+ gosu postgres pg_ctl -D " $PGDATA " \
5858 -o " -c listen_addresses=''" \
5959 -w start
6060
@@ -94,15 +94,15 @@ if [ "$1" = 'postgres' ]; then
9494 echo
9595 done
9696
97- su-exec postgres pg_ctl -D " $PGDATA " -m fast -w stop
97+ gosu postgres pg_ctl -D " $PGDATA " -m fast -w stop
9898 set_listen_addresses ' *'
9999
100100 echo
101101 echo ' PostgreSQL init process complete; ready for start up.'
102102 echo
103103 fi
104104
105- exec su-exec postgres " $@ "
105+ exec gosu postgres " $@ "
106106fi
107107
108108exec " $@ "
You can’t perform that action at this time.
0 commit comments