# Definizione dei volumi
services:
  smssmart_php:
    container_name: smssmart_php
    image: smssmart_php:latest
    build:
      context: ./config/production/php/5.6
      dockerfile: ./fpm_Dockerfile
    restart: unless-stopped
    expose:
      - 9000
    volumes:
      - /var/www/html:/var/www/html
      - ./config/production/php/5.6/php.ini:/usr/local/etc/php/php.ini
    ulimits:
      nofile:
        soft: 65535
        hard: 65535
    healthcheck:
      test: ["CMD", "php-fpm", "-t"]
      interval: 30s
      timeout: 10s
      retries: 3
    sysctls:
      net.core.somaxconn: 4096
    environment:
      - PHP_MEMORY_LIMIT=512M
      - PHP_MAX_EXECUTION_TIME=300
    networks:
      smssmart_net:
        ipv4_address: 192.168.176.2
  apache:
    container_name: apache
    image: apache:latest
    build: ./config/production/apache2
    restart: unless-stopped
    ports:
      - "80:80"
      - "8018:8018"
      - "8019:8019"
      - "8020:8020"
      - "8021:8021"
      - "8022:8022"
      - "443:443"
    depends_on:
      smssmart_php:
        condition: service_healthy
    volumes:
      - /var/www/html:/var/www/html
      - ./config/production/apache2/certs/:/etc/letsencrypt/
      - ./config/production/apache2/virtualhosts:/etc/apache2/sites-enabled
    ulimits:
      nofile:
        soft: 65535
        hard: 65535
    healthcheck:
      test: ["CMD", "apache2ctl", "configtest"]
      interval: 10s
      timeout: 10s
      retries: 3
    sysctls:
      net.core.somaxconn: 4096
      net.ipv4.tcp_keepalive_time: 600
      net.ipv4.tcp_keepalive_intvl: 60
      net.ipv4.tcp_keepalive_probes: 5
    networks:
      smssmart_net:
        ipv4_address: 192.168.176.4
networks:
  smssmart_net:
    ipam:
      driver: default
      config:
        - subnet: "192.168.176.0/24"