phonograph/dev-services/run-pg-with-apple-container.sh
2025-10-09 08:01:01 +00:00

18 lines
641 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 "$(dirname "$0")/dev-services/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:ro" \
-v phono-pg:/var/lib/postgresql/18/docker \
postgres:18