Skip to content

Instantly share code, notes, and snippets.

@edr3x
Last active August 7, 2023 12:26
Show Gist options
  • Save edr3x/ee9574d30f19bd8c825841de03734094 to your computer and use it in GitHub Desktop.
Save edr3x/ee9574d30f19bd8c825841de03734094 to your computer and use it in GitHub Desktop.
for running postgres on your machine via docker for Node.js
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_DB=mydatabase
DB_HOST=localhost
DB_PORT=5432
DB_SCHEMA=public
DB_VOL_NAME=mydbvol
# don't change anything on this key
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:${DB_PORT}/${POSTGRES_DB}?schema=${DB_SCHEMA}"
version: '3.8'
services:
postgres:
image: postgres:15.2
container_name: ${POSTGRES_DB}
ports:
- ${DB_PORT}:5432
volumes:
- postgres:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
postgres:
name: ${DB_VOL_NAME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment