From 76dcf6a13c5736ec15fb31fbc19c9eb8dee803a0 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 6 Sep 2018 12:26:06 +0200 Subject: initial build of gitlab image --- postgresql/docker-entrypoint.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 postgresql/docker-entrypoint.sh (limited to 'postgresql/docker-entrypoint.sh') diff --git a/postgresql/docker-entrypoint.sh b/postgresql/docker-entrypoint.sh new file mode 100755 index 0000000..c438de9 --- /dev/null +++ b/postgresql/docker-entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/sh -e + +_su(){ + su-exec postgres "$@" +} + +if ! [ -s "$PGDATA"/PG_VERSION ]; then + echo "Initializing database" + _su initdb --username=postgres + + _su pg_ctl -D "$PGDATA" \ + -o "-c listen_addresses=''" \ + -w start + + # create database for gitlab + _su psql -c "CREATE USER git CREATEDB;" + _su psql -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" + _su psql -c "CREATE DATABASE gitlabhq_production OWNER git;" + + _su pg_ctl -D "$PGDATA" -m fast -w stop +fi + +_su "$@" -- cgit v1.2.3