Mercury/entrypoint.sh
Matthew L McPeak 16eced643c
Some checks failed
ci / build-ui (push) Successful in 13s
ci / test (push) Successful in 3m0s
ci / publish (push) Failing after 22s
fix: Added postgres-sql
2026-06-17 16:45:28 -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