Postgresql recipe.
Showing
4 changed files
with
57 additions
and
0 deletions
postgresql/Dockerfile
0 → 100644
postgresql/files/configure
0 → 100755
1 | #!/bin/sh | ||
2 | |||
3 | set -e | ||
4 | |||
5 | mkdir /usr/share/man/man1 /usr/share/man/man7 | ||
6 | cp /tmp/files/no-suggests-recommends.conf /etc/apt/apt.conf.d/no-suggests-recommends | ||
7 | apt-get update | ||
8 | apt-get install -y postgresql-9.6 \ | ||
9 | $POSTGRESQL_EXTRA_PACKAGES \ | ||
10 | && true | ||
11 | |||
12 | rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* | ||
13 | |||
14 | mkdir /var/lib/container | ||
15 | tar -cC /var/lib/postgresql/ . | gzip -9v > /var/lib/container/var_lib_postgresql.tar.gz | ||
16 | rm -rf /var/lib/postgresql | ||
17 | mkdir /var/lib/postgresql | ||
18 | |||
19 | cp -a /tmp/files/entrypoint /sbin | ||
20 | |||
21 | rm -rf /tmp/files |
postgresql/files/entrypoint
0 → 100755
1 | #!/bin/bash | ||
2 | |||
3 | declare -a found_errors | ||
4 | |||
5 | set -ex | ||
6 | |||
7 | if [[ $(find /var/lib/postgresql -maxdepth 1 -mindepth 1|wc -l) = 0 ]]; then | ||
8 | zcat /var/lib/container/var_lib_postgresql.tar.gz | tar xf - -C /var/lib/postgresql | ||
9 | fi | ||
10 | |||
11 | postgres_home="$(getent passwd postgres | cut -f 6 -d :)" | ||
12 | |||
13 | if [[ $GID ]]; then | ||
14 | old_gid=$(getent group postgres | cut -f 3 -d :) | ||
15 | groupmod -g $GID postgres | ||
16 | find "$postgres_home" /etc/postgresql /var/run/postgresql -gid $old_gid -print0 | xargs -0r chgrp postgres | ||
17 | fi | ||
18 | |||
19 | if [[ $UID ]]; then | ||
20 | old_uid=$(getent passwd postgres | cut -f 3 -d :) | ||
21 | usermod -u $UID postgres | ||
22 | find /etc/postgresql /var/run/postgresql -uid $old_uid -print0 | xargs -0r chown postgres | ||
23 | fi | ||
24 | |||
25 | exec "$@" |
postgresql/files/no-suggests-recommends.conf
0 → 100644
-
Please register or sign in to post a comment