version: '2.4'

services:
  phpfpm:
    container_name: aurensis_arquetiposymfony_phpfpm
    restart: unless-stopped
    cpus: 2
    mem_limit: 4g
    build:
      context: ./phpfpm
    environment:
      - TZ=Europe/Madrid
    volumes:
      - ./cron.d:/etc/cron.d
      - ./phpfpm/www.conf:/opt/bitnami/php/etc/php-fpm.d/www.conf:ro
      - ./phpfpm/common.conf:/opt/bitnami/php/etc/common.conf:ro
      - ./phpfpm/php-custom.ini:/opt/bitnami/php/etc/conf.d/php-custom.ini:ro
      - ./web:/app
    networks:
      - aurensis-arquetiposymfony-network

  nginx-public:
    image: docker.io/bitnami/nginx:latest
    container_name: aurensis_arquetiposymfony_nginx
    restart: unless-stopped
    cpus: 2
    mem_limit: 4g
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.arquetiposymfony-http.rule=Host(`arquetiposymfony.servidortemporal.net`)"
      - "traefik.http.routers.arquetiposymfony-http.entrypoints=web"
      - "traefik.http.routers.arquetiposymfony-http.middlewares=arquetiposymfony-https,arquetiposymfony-whitelist"
      #- "traefik.http.middlewares.arquetiposymfony-whitelist.ipwhitelist.sourcerange=188.87.137.114/32, 85.62.68.105/32, 54.36.219.131/32"
      - "traefik.http.middlewares.arquetiposymfony-https.redirectscheme.scheme=https"
      - "traefik.http.routers.arquetiposymfony.entrypoints=websecure"
      - "traefik.http.routers.arquetiposymfony.rule=Host(`arquetiposymfony.servidortemporal.net`)"
      - "traefik.http.routers.arquetiposymfony.tls.certresolver=le"
    depends_on:
      - phpfpm
    networks:
      - aurensis-arquetiposymfony-network
      - web
    volumes:
      - ./nginx/server.conf:/opt/bitnami/nginx/conf/server_blocks/my_server_block.conf:ro
      - ./nginx/nginx.conf:/opt/bitnami/nginx/conf/nginx.conf:ro
      - ./nginx/wildcard.devel.test.crt:/opt/bitnami/certs/server.crt:ro
      - ./nginx/wildcard.devel.test.key:/opt/bitnami/certs/server.key:ro
      - ./web:/app
    environment:
      - TZ=Europe/Madrid

networks:
  aurensis-arquetiposymfony-network:
    driver: bridge
  web:
    external: true

