phonograph/dev-services/run-pg-with-apple-container.sh
2025-11-22 06:31:05 +00:00

18 lines
642 B
Bash

#!/bin/sh
# Starts a Postgres container using Apple's `container` tool:
# https://github.com/apple/container
#
# You'll need to use `container list` to find the new container's IP address in
# order to connect to it from the Phonograph server.
if ! (container volume ls | grep 'phono-pg'); then
container volume create -s 2G phono-pg
fi
container run --name phono-pg \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=guest \
-e PGDATA=/var/lib/postgresql/18/docker/pgdata \
-v "$(realpath "$(dirname "$0")")/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:ro" \
-v phono-pg:/var/lib/postgresql/18/docker \
postgres:18