mirror of
https://github.com/ChristianLempa/boilerplates.git
synced 2024-12-24 16:09:03 +01:00
911fcc61eb
Unless explicitely set, the database name is nevertheless derived from the user by the image's entrypoint, but we can make this more obvious by defining a interpolation here.
41 lines
1.0 KiB
YAML
41 lines
1.0 KiB
YAML
---
|
|
version: "3.8"
|
|
|
|
services:
|
|
postgres:
|
|
image: docker.io/library/postgres:16.2
|
|
environment:
|
|
- POSTGRES_INITDB_ARGS=${POSTGRES_INITDB_ARGS---data-checksums}
|
|
- POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD-}
|
|
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
|
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password
|
|
- POSTGRES_DB=${POSTGRES_DB:-$POSTGRES_USER}
|
|
- TZ=${TZ:-UTC}
|
|
ports:
|
|
- 5432:5432
|
|
# (Optional) when using custom network, see also
|
|
# https://docs.docker.com/compose/compose-file/compose-file-v3/#networks
|
|
#
|
|
# networks:
|
|
# - yournetwork
|
|
secrets:
|
|
- postgres_password
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
restart: unless-stopped
|
|
|
|
# (Optional) when using custom network, see also
|
|
# https://docs.docker.com/compose/compose-file/compose-file-v3/#network-configuration-reference
|
|
#
|
|
# networks:
|
|
# yournetwork:
|
|
# external: true
|
|
|
|
secrets:
|
|
postgres_password:
|
|
file: secret.postgres_password.txt
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|