postgres / entrypoint.sh
bpandey23's picture
Update entrypoint.sh
0ba050c verified
raw
history blame contribute delete
363 Bytes
#!/bin/bash
# Check if the PostgreSQL data directory is empty
if [ -z "$(ls -A /var/lib/postgresql/data)" ]; then
echo "Initializing PostgreSQL database..."
su - foobar -c "/usr/lib/postgresql/*/bin/initdb -D /var/lib/postgresql/data"
fi
# Start the PostgreSQL server
exec su - foobar -c "/usr/lib/postgresql/*/bin/postgres -D /var/lib/postgresql/data"