services:
  #=====================
  # https://assalatev3.docker.localhost
  # http://localhost:8100
  assalatev3_web:
    image: slatrach/php8.4-apache:1.1
    container_name: assalatev3_web
    platform: linux/amd64
    env_file:
      - .env
      - .env.local
    ports:
      - "${APP_DEV_PORT_APACHE:-8100}:80"   #http://localhost:8100
      - "${APP_DEV_PORT_NODE:-3100}:${APP_DEV_PORT_NODE:-3100}" #webpack dev-server
    extra_hosts:
      - "assalatev3.docker.localhost:127.0.0.1"
    volumes:
      - ./docker/apache2/000-default.conf:/etc/apache2/sites-enabled/000-default.conf
      - ./docker/apache2/ports.conf:/etc/apache2/ports.conf
      - ./:/var/www
      - "/etc/timezone:/etc/timezone:ro"
      - "/etc/localtime:/etc/localtime:ro"
    labels:
      - "traefik.enable=true"
      # HTTPS router
      - "traefik.http.routers.assalatev3_web.entrypoints=https"
      - "traefik.http.routers.assalatev3_web.rule=Host(`assalatev3.docker.localhost`)"
      - "traefik.http.routers.assalatev3_web.tls=true"
      # HTTP → HTTPS redirect
      - "traefik.http.routers.assalatev3_web_http.entrypoints=http"
      - "traefik.http.routers.assalatev3_web_http.rule=Host(`assalatev3.docker.localhost`)"
      - "traefik.http.routers.assalatev3_web_http.middlewares=redirect-to-https"
      - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
  assalatev3_mysql:
    image: mysql:8.0
    container_name: assalatev3_mysql
    platform: linux/amd64
    ports:
      - 3308:3306 # DBeaver localhost 3308
    volumes:
      - assalatev3_mysql:/var/lib/mysql
      - "/etc/timezone:/etc/timezone:ro"
      - "/etc/localtime:/etc/localtime:ro"
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"

volumes:
  assalatev3_mysql:

networks:
  default:
    name: traefik
    external: true
