32 lines
812 B
YAML
32 lines
812 B
YAML
services:
|
|
db:
|
|
image: postgres:${POSTGRES_VERSION:-16}
|
|
container_name: postgres
|
|
ports:
|
|
- '5432:5432'
|
|
environment:
|
|
- POSTGRES_DB=${POSTGRES_DB:-nice_db}
|
|
- POSTGRES_USER=${POSTGRES_USER:-nice_user}
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-nice_password}
|
|
volumes:
|
|
- ./volumes/postgres:/var/lib/postgresql/data
|
|
# - type: volume
|
|
# source: postgres_data
|
|
# target: /var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ['CMD-SHELL', "sh -c 'pg_isready -U ${POSTGRES_USER:-nice_user} -d ${POSTGRES_DB:-nice_db}'"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 3
|
|
restart: always
|
|
networks:
|
|
- nice-net
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
device: ${PWD}/volumes/postgres
|
|
o: bind
|