Skip to content

Commit 9436509

Browse files
committed
chore(docker): use the full name of registry
1 parent f0a25ce commit 9436509

6 files changed

Lines changed: 21 additions & 19 deletions

File tree

Dockerfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
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
55
ARG GOBIN=/usr/local/bin
6-
ARG WAL_G_VERSION=v0.2.15
6+
ARG WAL_G_VERSION=v0.2.19
77

88
RUN 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

1919
COPY rootfs /
2020
COPY --from=mc /usr/bin/mc /bin/mc
@@ -24,10 +24,12 @@ ENV PGDATA $PGDATA/$PG_MAJOR
2424
ENV WALG_ENVDIR /etc/wal-g.d/env
2525

2626
RUN 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

3335
CMD ["/docker-entrypoint.sh", "postgres"]

charts/database/templates/database-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ spec:
4545
preStop:
4646
exec:
4747
command:
48-
- su-exec
48+
- gosu
4949
- postgres
5050
- do_backup
5151
readinessProbe:

rootfs/bin/is_running

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ if [[ -f "$PGDATA/recovery.signal" ]]; then
88
exit 1
99
fi
1010

11-
su-exec postgres pg_ctl status
11+
gosu postgres pg_ctl status

rootfs/docker-entrypoint-initdb.d/003_restore_from_backup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
if [[ $(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
}
@@ -43,7 +43,7 @@ EOF
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
4949
else
@@ -61,7 +61,7 @@ EOF
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
6565
fi
6666

6767
# ensure $PGDATA has the right permissions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env bash
22

33
# Run periodic backups in the background
4-
su-exec postgres backup &
4+
gosu postgres backup &

rootfs/docker-entrypoint.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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 "$@"
106106
fi
107107

108108
exec "$@"

0 commit comments

Comments
 (0)