Files
mykopkb-be/docker/production/docker-compose.data.yml
T
ismailmasseran a627afb6c5
Build Docker Image / build-backend (push) Successful in 1m18s
DONE: implement best practice for cicd, separate docker compose
2026-10-25 15:23:55 +08:00

71 lines
1.8 KiB
YAML

# Stateful stack. Deploy this only when Postgres or Redis should change.
# The backend reaches these services by the network aliases db and redis.
services:
db:
image: postgres:17
container_name: mykopkb-postgres-production
restart: unless-stopped
ports:
- "${DB_PORT:-5433}:5432"
environment:
- POSTGRES_USER=${DB_USERNAME}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_DATABASE}
volumes:
- db-data-production:/var/lib/postgresql/data
- ./docker/postgres/conf.d:/etc/postgres/conf.d:ro
networks:
mykopkb-production-network:
aliases:
- db
healthcheck:
test:
[
"CMD-SHELL",
'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" || exit 1',
]
interval: 15s
timeout: 10s
retries: 5
start_period: 30s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
redis:
image: redis:8
container_name: mykopkb-redis-production
restart: unless-stopped
volumes:
- redis-data-production:/data
- ./redis-config/redis.conf:/usr/local/etc/redis/redis.conf:ro
command: redis-server /usr/local/etc/redis/redis.conf
networks:
mykopkb-production-network:
aliases:
- redis
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
mykopkb-production-network:
name: mykopkb-production-network
external: true
volumes:
db-data-production:
name: mykopkb-db-data-production
redis-data-production:
name: mykopkb-redis-data-production