Skip to content

Instantly share code, notes, and snippets.

@tbjgolden
Last active May 24, 2021 15:06
Show Gist options
  • Save tbjgolden/f22f147a7582e782c4c4a82823fc95ef to your computer and use it in GitHub Desktop.
Save tbjgolden/f22f147a7582e782c4c4a82823fc95ef to your computer and use it in GitHub Desktop.
Figure I'll need this again
version: "3.8"
services:
db:
image: "postgres:12"
ports:
- "54320:5432"
volumes:
- ./pgdata:/var/lib/postgresql/data
environment:
- POSTGRES_USER=usrnm
- POSTGRES_PASSWORD=passwd
- POSTGRES_DB=demo
# change vars
# rebuild with:
# docker-compose up --build --force-recreate -d
# enter container:
# docker-compose run db bash
# enter postgres interpreter:
# psql --username=usrnm --dbname=demo --host=db
# add .env file
# DATABASE_URL="postgresql://usrnm:passwd@localhost:54320/demo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment