78 lines
1.7 KiB
YAML
78 lines
1.7 KiB
YAML
---
|
|
services:
|
|
example:
|
|
image: example/example:latest
|
|
container_name: example
|
|
pull_policy: always
|
|
restart: unless-stopped
|
|
ports:
|
|
- 127.0.0.1:${PORT}:999999
|
|
volumes:
|
|
- type: bind
|
|
source: ${VOLUME_PATH}
|
|
target: /path/to/data/used/by/app
|
|
bind:
|
|
create_host_path: true
|
|
environment:
|
|
PUID: ${PUID}
|
|
PGID: ${PGID}
|
|
user: ${PUID}:${PGID} # remove if running as root
|
|
# depends_on:
|
|
# postgres:
|
|
# condition: service_healthy
|
|
# restart: true
|
|
# redis:
|
|
# condition: service_healthy
|
|
# restart: true
|
|
|
|
postgres:
|
|
image: postgres:18
|
|
container_name: example-postgres
|
|
pull_policy: always
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql
|
|
user: ${PUID}:${PGID}
|
|
healthcheck:
|
|
test:
|
|
[
|
|
'CMD-SHELL',
|
|
'psql -U ${POSTGRES_USER} -d ${POSTGRES_DB} -c "select version();"',
|
|
]
|
|
interval: 1s
|
|
retries: 5
|
|
timeout: 5s
|
|
|
|
redis:
|
|
image: redis:alpine
|
|
container_name: example-redis
|
|
command: redis-server --save 60 1 --loglevel warning
|
|
pull_policy: always
|
|
restart: unless-stopped
|
|
volumes:
|
|
- redis_data:/data
|
|
user: ${PUID}:${PGID}
|
|
healthcheck:
|
|
test: ['CMD-SHELL', 'redis-cli ping | grep PONG']
|
|
interval: 1s
|
|
retries: 5
|
|
timeout: 3s
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${VOLUME_PATH}/postgres
|
|
redis_data:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${VOLUME_PATH}/redis
|