services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: quailmanager-app
    restart: always
    ports:
      - "3003:3000"
    environment:
      - DATABASE_URL=postgresql://quail:quailpass@db:5432/quaildb
      - NODE_ENV=production
    depends_on:
      - db
    networks:
      - quail-net-prod

  db:
    image: postgres:16-alpine
    container_name: quailmanager-db
    restart: always
    environment:
      POSTGRES_USER: quail
      POSTGRES_PASSWORD: quailpass
      POSTGRES_DB: quaildb
    ports:
      - "5434:5432"
    volumes:
      - quail_pgdata:/var/lib/postgresql/data
    networks:
      - quail-net-prod

  nginx:
    image: nginx:alpine
    container_name: quailmanager-nginx
    restart: always
    ports:
      - "7443:443"
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - /home/attendance/public_html/ssl_certs:/etc/letsencrypt:ro
    depends_on:
      - app
    networks:
      - quail-net-prod

volumes:
  quail_pgdata:

networks:
  quail-net-prod:
    driver: bridge
