version: '2'

services:
  kamailio:
    build: ./kamailio
    restart: always
    hostname: kamailio
    container_name: kamailio
    entrypoint:
      - /bin/bash
      - /etc/kamailio/entrypoint.sh
    volumes:
      - ./kamailio:/etc/kamailio
      - /opt/docker/secure/fullchain.pem:/etc/kamailio/kamailio.pem:ro
      - /opt/docker/secure/privkey.pem:/etc/kamailio/kamailio.key:ro
      - ./kamailio/kamailio:/etc/default/kamailio
      - ./kamailio/rtpproxy:/etc/default/rtpproxy
#    ports:
#      - "5060:5060/tcp"
#      - "5060:5060/udp"
#      - "5061:5061/tcp"
#      - "5061:5061/udp"
#      - "35000-35400:35000-35400/tcp"
#      - "35000-35400:35000-35400/udp"
#    ulimits:
#      nofile:
#        soft: 65536
#        hard: 65536
    network_mode: "host"

  nodekami:
    build: ./nodekami
    restart: always
    hostname: nodekami
    container_name: nodekami
    entrypoint:
      - node
      - index
    volumes:
      - ./nodekami/confi.json:/nodekami/app/confi.json
      - ./nodekami/index.js:/nodekami/app/index.js
      - ./nodekami/publicindex.js:/nodekami/app/public/js/index.js
      - ./nodekami/rsaprivada.pem:/nodekami/app/rsaprivada.pem
      - ./kamailio/kamailio.sqlite:/nodekami/app/kamailio.sqlite
    expose:
      - 3000
    networks:
      mynet:
        ipv4_address: 172.127.0.101

networks:
  mynet:
    driver: bridge
    ipam:
      config:
      - subnet: 172.127.0.0/24
