Last active
January 12, 2023 16:00
-
-
Save ignavan39/beb5847e2c5180d7287d7edd64f8f2ab to your computer and use it in GitHub Desktop.
Docker-compose with Postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATABASE_NAME= | |
DATABASE_USER= | |
DATABASE_PASSWORD= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.9' | |
volumes: | |
postgres_data: | |
pgadmin: | |
services: | |
postgres: | |
container_name: container-name_db | |
image: postgres:11.13-alpine | |
command: | |
- 'postgres' | |
- '-c' | |
- 'max_connections=50' | |
- '-c' | |
- 'shared_buffers=1GB' | |
- '-c' | |
- 'effective_cache_size=4GB' | |
- '-c' | |
- 'work_mem=16MB' | |
- '-c' | |
- 'maintenance_work_mem=512MB' | |
- '-c' | |
- 'random_page_cost=1.1' | |
- '-c' | |
- 'temp_file_limit=10GB' | |
- '-c' | |
- 'log_min_duration_statement=200ms' | |
- '-c' | |
- 'idle_in_transaction_session_timeout=10s' | |
- '-c' | |
- 'lock_timeout=1s' | |
- '-c' | |
- 'statement_timeout=60s' | |
- '-c' | |
- 'shared_preload_libraries=pg_stat_statements' | |
- '-c' | |
- 'pg_stat_statements.max=10000' | |
- '-c' | |
- 'pg_stat_statements.track=all' | |
environment: | |
POSTGRES_DB: ${DATABASE_NAME} | |
POSTGRES_USER: ${DATABASE_USER} | |
POSTGRES_PASSWORD: ${DATABASE_PASSWORD} | |
volumes: | |
- postgres_data:/var/lib/postgresql/data | |
ports: | |
- '5432:5432' | |
healthcheck: | |
test: ['CMD-SHELL', 'pg_isready -U user -d databaseName'] | |
interval: 10s | |
timeout: 5s | |
retries: 5 | |
start_period: 10s | |
deploy: | |
resources: | |
limits: | |
cpus: '1' | |
memory: 4G |
Author
ignavan39
commented
Oct 12, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment