2023-12-11 14:57:49 +01:00
|
|
|
---
|
|
|
|
services:
|
|
|
|
postgres:
|
2024-03-26 11:59:45 +01:00
|
|
|
image: postgres:16.2
|
|
|
|
container_name: postgres
|
2023-12-11 14:57:49 +01:00
|
|
|
environment:
|
2024-03-02 16:29:10 +01:00
|
|
|
- POSTGRES_INITDB_ARGS=${POSTGRES_INITDB_ARGS---data-checksums}
|
2024-03-02 16:33:39 +01:00
|
|
|
- POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD-}
|
2024-03-02 16:43:49 +01:00
|
|
|
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
2024-03-02 16:17:47 +01:00
|
|
|
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password
|
2024-03-02 16:43:49 +01:00
|
|
|
- POSTGRES_DB=${POSTGRES_DB:-$POSTGRES_USER}
|
2024-03-02 16:35:30 +01:00
|
|
|
- TZ=${TZ:-UTC}
|
2023-12-11 14:57:49 +01:00
|
|
|
ports:
|
|
|
|
- 5432:5432
|
2024-03-02 16:48:26 +01:00
|
|
|
healthcheck:
|
|
|
|
test: ['CMD-SHELL', 'pg_isready -U "${POSTGRES_USER:-postgres}"']
|
|
|
|
start_period: 30s
|
|
|
|
interval: 10s
|
|
|
|
timeout: 10s
|
|
|
|
retries: 5
|
2024-03-26 11:59:45 +01:00
|
|
|
# (Optional) When using custom network, see also
|
|
|
|
# https://docs.docker.com/compose/compose-file/compose-file-v3/#networks
|
2024-03-02 16:14:12 +01:00
|
|
|
#
|
2023-12-11 14:57:49 +01:00
|
|
|
# networks:
|
|
|
|
# - yournetwork
|
2024-03-02 16:17:47 +01:00
|
|
|
secrets:
|
|
|
|
- postgres_password
|
2023-12-11 14:57:49 +01:00
|
|
|
volumes:
|
2024-03-02 15:39:32 +01:00
|
|
|
- postgres_data:/var/lib/postgresql/data
|
2023-12-11 14:57:49 +01:00
|
|
|
restart: unless-stopped
|
2024-03-02 15:39:32 +01:00
|
|
|
|
2024-03-26 11:59:45 +01:00
|
|
|
# (Optional) When using custom network, see also
|
|
|
|
# https://docs.docker.com/compose/compose-file/compose-file-v3/#network-configuration-reference
|
2024-03-02 16:14:12 +01:00
|
|
|
#
|
2024-03-02 15:39:32 +01:00
|
|
|
# networks:
|
|
|
|
# yournetwork:
|
|
|
|
# external: true
|
|
|
|
|
2024-03-02 16:17:47 +01:00
|
|
|
secrets:
|
|
|
|
postgres_password:
|
|
|
|
file: secret.postgres_password.txt
|
|
|
|
|
2024-03-02 15:39:32 +01:00
|
|
|
volumes:
|
|
|
|
postgres_data:
|
2024-03-02 16:03:29 +01:00
|
|
|
driver: local
|