version: '3.8'

x-logging: &logging
  logging:
    driver: "json-file"
    options:
      max-file: "5"
      max-size: "10m"
x-network: &network
  network_mode: "host"

services:

  postgres:
    image: postgres:13.5
    restart: always
    environment:
      - POSTGRES_USER=${DB_USER}
      - POSTGRES_PASSWORD=${DB_PASSWORD}
    volumes:
      - postgres:/var/lib/postgresql/data
    <<: [*logging,*network]

  redis:
    hostname: redis
    container_name: redis
    image: redis:6.2.11-alpine
    volumes:
      - redis-data:/data
    <<: [*logging,*network]
volumes:
  postgres:
  redis-data:
