Skip to content

Instantly share code, notes, and snippets.

@namp10010
Created November 13, 2023 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save namp10010/7a02879d286f9f82db9d70cf92afa52a to your computer and use it in GitHub Desktop.
Save namp10010/7a02879d286f9f82db9d70cf92afa52a to your computer and use it in GitHub Desktop.
postgres docker-compose with init scripts and health check.
postgres_db:
image: postgres
deploy:
resources:
limits:
memory: 125M
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d postgres -U postgres" ]
interval: 5s
timeout: 5s
retries: 5
volumes:
- ./test/db/postgresql/init/:/docker-entrypoint-initdb.d/
- ./.volumes/postgres:/var/lib/postgresql/data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment