---
version: '3.8'

services:
  api:
    privileged: true
    build:
      context: .
      dockerfile: ./Dockerfile
      network: host
    image: docaposte/ubuntu20-apache2-php8:1.0.0
    environment:
      - TZ=Europe/Paris
    ports:
      - '8800:80'
      - '8880:443'
    container_name: API-AES
    hostname: api-aes-local.demat.lan
    restart: unless-stopped
    expose:
      - 80
      - 443
    volumes:
      - apiaesdata:/data:rw
      - nfs-upload:/mnt/nfs-upload:rw
      - ./:/data/sites/api:rw
      - ./config/apache/api.conf:/etc/apache2/sites-available/api.conf
      - ./config/apache/ssl-api.conf:/etc/apache2/sites-available/ssl-api.conf
      - ./config/apache/apache2.conf:/etc/apache2/apache2.conf
      - ./config/apache/php.ini:/etc/php.ini
      - /sys/fs/cgroup:/sys/fs/cgroup:rw
      - .:/app:cached
    tty: true
    tmpfs:
      - /run
      - /run/lock
      - /tmp
    extra_hosts:
      - "api-aes-local.demat.lan:127.0.0.1"
      - "api-aes-local.demat.lan:172.22.0.23"
      - "mongodb-local.demat.lan:172.22.0.1"
      - "upload-bundle-local.demat.lan:172.22.0.1"
    networks:
      nginx-proxy:
        ipv4_address: 172.22.0.23
    entrypoint:
      - /lib/systemd/systemd

volumes:
  apiaesdata:
    driver: local
  nfs-upload: ## Le nom de mon volume en montage NFS
    driver: local
  #  driver_opts: ## Définition des options du montage
  #    type: nfs ## Choix du type de montage
  #    o: addr=172.22.0.20,nolock,soft,rw ## Indication de l'adresse IP du stockage et des options d'accès
  #    device: :/data/upload/   ## Indication du chemin du montage sur le stockage
networks:
  nginx-proxy:
    name: nginx-proxy
    external: true
