version: "3.9"
services:
  server:
    build: ./server
    env_file:
      - ./server/.env.prod
    environment:
      - NODE_ENV=production
    ports:
      - "4000:4000"
    volumes:
      - server_data:/app/.data
    depends_on:
      - # db  # descomente se usar Postgres
    networks:
      - truco_net

  web:
    build:
      context: ./web
      args:
        VITE_API_URL: ${VITE_API_URL-http://localhost:4000}
        VITE_WS_URL: ${VITE_WS_URL-ws://localhost:4000}
    environment:
      - NODE_ENV=production
    ports:
      - "80:80"
    depends_on:
      - server
    networks:
      - truco_net

  # db:
  #   image: postgres:15
  #   environment:
  #     POSTGRES_PASSWORD: postgres
  #     POSTGRES_USER: postgres
  #     POSTGRES_DB: truco
  #   volumes:
  #     - pgdata:/var/lib/postgresql/data
  #   ports:
  #     - "5432:5432"
  #   networks:
  #     - truco_net

volumes:
  server_data:
  # pgdata:

networks:
  truco_net:
    driver: bridge
