Simple PostgreSQL docker-compose config

This is a simple docker-compose config for PostgreSQL.

version: '3.8'

services:
  postgres:
    image: postgres:16
    restart: unless-stopped
    volumes:
      - ./pg_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=spirofit
      - POSTGRES_USER=spirofit

You can set ${POSTGRES_PASSWORD} in a .env file like this:

POSTGRES_PASSWORD=kou4fo7Ievahwohgah1ifah2Cee7oh

Now you can start the database with docker-compose up.