Skip to content

Instantly share code, notes, and snippets.

@jlainezs
Last active October 31, 2025 09:55
Show Gist options
  • Select an option

  • Save jlainezs/ec201ddd9a68d257ef9e23ff54fb336d to your computer and use it in GitHub Desktop.

Select an option

Save jlainezs/ec201ddd9a68d257ef9e23ff54fb336d to your computer and use it in GitHub Desktop.
PostgreSQL and email service on a docker compose
# use ./docker/db-data/postgres as local volume
# needs a .env file with
#
# PG_VERSION=18.0 // this is the PostgreSQL version to use
# PG_USER=****** // your postresql user
# PG_PASSWORD=****** // yourr postgresql user password
# PG_DATABASE=****** // your database
# PG_PUB_PORT=5432 // the port to publish ou your server
#
services:
postgres:
image: 'postgres:${PG_VERSION}'
ports:
- "${PG_PUB_PORT}:5432"
restart: unless-stopped
environment:
POSTGRES_USER: ${PG_USER}
POSTGRES_PASSWORD: ${PG_PASSWORD}
POSTGRES_DB: ${PG_DATABASE}
volumes:
# - ./docker/db-data/postgres/:/var/lib/postgresql/data/
# Postgres 18 doesn't want /data
- ./docker/db-data/postgres/:/var/lib/postgresql
mailhog:
image: 'mailhog/mailhog:latest'
ports:
- "1025:1025"
- "8025:8025"
restart: unless-stopped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment