A customized PostgreSQL Docker image based on PostgreSQL 16.4, configured to allow remote connections with SCRAM-SHA-256 authentication.
This image is a generic Postgres runtime for BehindTheMusicTree services. It contains no application schema or migrations—those belong in your application repo (e.g. Django migrations). Use it with any Postgres client (Django, other backends). You can use the same image across multiple services or environments for consistent Postgres version and config.
- Scope
- Features
- When to use this image
- Prerequisites
- Building the Image
- Running the Container
- Connecting to the Database
- Configuration
- Files
- Contributing
- License
- Based on official PostgreSQL 16.4 image
- Pre-installed dependencies: gettext, postgresql-client, net-tools
- Configured for remote connections with SCRAM-SHA-256 authentication
- Automatic configuration reload
- Use when: You need Postgres 16.4 with remote SCRAM-SHA-256 and the included tools (gettext, postgresql-client, net-tools).
- Look elsewhere when: You need a different Postgres version or additional extensions (extend this image or use the official one).
- Docker installed on your system
To build the Docker image, run the following command in the project directory:
docker build -t bodzify-db-postgres .To run the PostgreSQL container, use:
docker run -d \
--name my-postgres \
-e POSTGRES_PASSWORD=mysecretpassword \
-e POSTGRES_DB=mydatabase \
-p 5432:5432 \
bodzify-db-postgresThe container supports standard PostgreSQL environment variables:
POSTGRES_PASSWORD: Sets the password for the default postgres userPOSTGRES_USER: Sets the username for the default user (defaults to postgres)POSTGRES_DB: Sets the name of the default database
- 5432: Default PostgreSQL port
Once the container is running, you can connect to the database using any PostgreSQL client:
psql -h localhost -p 5432 -U postgres -d mydatabaseThe image includes custom configuration in setup_conf.sh that:
- Adds a pg_hba.conf entry to allow remote connections from any IP with SCRAM-SHA-256 authentication
- Reloads the PostgreSQL configuration
What this image does not include: No application schema or migrations (e.g. Django migrations live in your app repo). No default database name or app-specific users beyond what you set via POSTGRES_DB and POSTGRES_USER.
Dockerfile: Docker image definitioninstall_dependencies.sh: Script to install additional dependenciessetup_conf.sh: Script to configure PostgreSQL for remote access.github/workflows/publish.yaml: GitHub Actions workflow for automated builds and releases.github/scripts/check-required-config.sh: Script to validate required variables and secrets
Contributions are welcome! This project follows GitHub Flow and all changes go through Pull Requests.
Please read CONTRIBUTING.md for:
- Development workflow and branching strategy
- Code style and commit message conventions
- Testing requirements
- Pull request process and checklist
- Release process (for maintainers)
[Specify your license here]