
version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: gerenciador_curriculos_app
    restart: unless-stopped
    volumes:
      - /var/lib/docker/volumes/gerenciador_curriculos_app/_data:/var/www/html
      - ./public/uploads:/var/www/html/public/uploads
      - ./logs:/var/www/html/logs
      - app_sessions:/tmp
    environment:
      - APP_NAME=Gerenciador de Currículos
      - APP_URL=https://rh.rivadavia.com.br
      - APP_DEBUG=false
      - DB_HOST=209.126.87.237
      - DB_NAME=rivadavi_ger_curriculos
      - DB_USER=rivadavi_ger_curriculos
      - DB_PASS=Fji&*uwF6UTz6sZ6
      - SESSION_TIMEOUT=3600
      - PASSWORD_MIN_LENGTH=6
    networks:
      - RcTecNet
    labels:
      # Labels para Traefik
      - "traefik.enable=true"
      - "traefik.http.routers.curriculos.rule=Host(`rh.rivadavia.com.br`)"
      - "traefik.http.routers.curriculos.entrypoints=websecure"
      - "traefik.http.services.curriculos.loadbalancer.server.port=80"
      - "traefik.docker.network=RcTecNet"
      - "traefik.http.routers.curriculos.tls.certresolver=letsencrypt"
      
      # Redirecionamento HTTP para HTTPS
      - "traefik.http.routers.curriculos-http.rule=Host(`rh.rivadavia.com.br`)"
      - "traefik.http.routers.curriculos-http.entrypoints=web"
      - "traefik.http.routers.curriculos-http.middlewares=curriculos-redirect"
      - "traefik.http.middlewares.curriculos-redirect.redirectscheme.scheme=https"

  # phpMyAdmin para administração do banco externo
  phpmyadmin:
    image: phpmyadmin:5.2-apache
    container_name: gerenciador_curriculos_phpmyadmin
    restart: unless-stopped
    environment:
      PMA_HOST: 209.126.87.237
      PMA_PORT: 3306
      PMA_USER: rivadavi_ger_curriculos
      PMA_PASSWORD: Fji&*uwF6UTz6sZ6
      MYSQL_ROOT_PASSWORD: Fji&*uwF6UTz6sZ6
      PMA_ARBITRARY: 1
    networks:
      - RcTecNet
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.phpmyadmin.rule=Host(`rhsql.rivadavia.com.br`)"
      - "traefik.http.routers.phpmyadmin.entrypoints=websecure"
      - "traefik.http.services.phpmyadmin.loadbalancer.server.port=80"
      - "traefik.docker.network=RcTecNet"
      - "traefik.http.routers.phpmyadmin.tls.certresolver=letsencrypt"
      
      # Redirecionamento HTTP para HTTPS
      - "traefik.http.routers.phpmyadmin-http.rule=Host(`rhsql.rivadavia.com.br`)"
      - "traefik.http.routers.phpmyadmin-http.entrypoints=web"
      - "traefik.http.routers.phpmyadmin-http.middlewares=phpmyadmin-redirect"
      - "traefik.http.middlewares.phpmyadmin-redirect.redirectscheme.scheme=https"

networks:
  RcTecNet:
    external: true

volumes:
  app_sessions:
    driver: local
