services:
  db:
    image: postgres:15
    container_name: ${pollarisDBName}
    restart: unless-stopped
    env_file:
      - ../../secret/env-${pollarisDBName}      
    volumes:
      - pollaris_db_data:/var/lib/postgresql/data
    networks:
      - pollarisNet

  app:
    build: .
    container_name: ${pollarisServName}
    restart: unless-stopped
    depends_on:
      - db
    env_file:
      - ../../secret/env-${pollarisServName}      
    environment:
      APP_ENV: prod
    networks:
      - pollarisNet
      - postfixNet
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.pollaris.rule=Host(`${pollarisHost}.${domain}`)"
      - "traefik.http.services.pollaris.loadbalancer.server.port=80"
    volumes:
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro

volumes:
  pollaris_db_data:

networks:
  pollarisNet:
    external: true
  postfixNet:
    external: true
