version: '2.4'

networks:
    ctel:
      driver: bridge
      
services:
  db:
    mem_reservation: 500m
    mem_limit: 1g
    container_name: db
    image: postgres:14.7-alpine
    ports:
      - "${DB_PUBLIC_PORT}:${DB_INTERNAL_PORT}"
    volumes:
      - db_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=${DB_USER}
      - POSTGRES_PASSWORD=${DB_PASSWORD}
      - POSTGRES_DB=${DB_SCHEMA}
    networks:
      - ctel
  rabbitmq:
    mem_reservation: 600m
    mem_limit: 4g
    container_name: rabbitmq
    restart: always
    image: rabbitmq:3.10-alpine
    ports:
      - "5672:5672"
      - "15672:15672"
      - "15692:15692"
    volumes:
      - rabbitmq_data:/var/lib/rabbitmq
    environment:
      - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER}
      - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS}
    networks:
      - ctel
volumes:
  db_data:
  rabbitmq_data: