Mercury/entrypoint.sh
Matthew L McPeak 0eeb2ed207
All checks were successful
ci / build-ui (push) Successful in 14s
ci / test (push) Successful in 2m57s
ci / publish (push) Successful in 2m26s
Initial Commit
2026-06-17 19:56:53 -04:00

20 lines
695 B
Bash

#!/bin/sh
set -e
PGDATA="${PGDATA:-/var/lib/postgresql/data}"
PGLOG="/var/log/postgresql/postgresql.log"
mkdir -p "$PGDATA" /var/log/postgresql
chown postgres:postgres "$PGDATA" /var/log/postgresql
if [ ! -f "$PGDATA/PG_VERSION" ]; then
su -s /bin/sh postgres -c "initdb -D $PGDATA"
su -s /bin/sh postgres -c "pg_ctl start -D $PGDATA -w -l $PGLOG"
su -s /bin/sh postgres -c "psql postgres -c \"CREATE USER mercury WITH PASSWORD 'mercury';\""
su -s /bin/sh postgres -c "psql postgres -c \"CREATE DATABASE mercury OWNER mercury;\""
su -s /bin/sh postgres -c "pg_ctl stop -D $PGDATA -w"
fi
su -s /bin/sh postgres -c "pg_ctl start -D $PGDATA -w -l $PGLOG"
exec /app/mercury