version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
      target: builder
    container_name: evoting-app
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=development
      - NEXT_PUBLIC_API_BASE_URL=${NEXT_PUBLIC_API_BASE_URL:-http://localhost:4000}
      - NEXT_PUBLIC_API_AUTH_HEADER=${NEXT_PUBLIC_API_AUTH_HEADER}
      - JWT_SECRET=${JWT_SECRET:-your-secret-key-change-this}
      - NEXT_PUBLIC_BASE_URL=${NEXT_PUBLIC_BASE_URL:-http://localhost:3000}
    volumes:
      - .:/app
      - /app/node_modules
      - /app/.next
    command: npm run dev
    networks:
      - evoting-network

  # Optional: Add a database service (PostgreSQL example)
  # Uncomment if you need a database
  # db:
  #   image: postgres:15-alpine
  #   container_name: evoting-db
  #   restart: unless-stopped
  #   environment:
  #     - POSTGRES_USER=evoting
  #     - POSTGRES_PASSWORD=evoting_password
  #     - POSTGRES_DB=evoting_db
  #   volumes:
  #     - postgres_data:/var/lib/postgresql/data
  #   ports:
  #     - "5432:5432"
  #   networks:
  #     - evoting-network

  # Optional: Add Redis for caching/sessions
  # Uncomment if you need Redis
  # redis:
  #   image: redis:7-alpine
  #   container_name: evoting-redis
  #   restart: unless-stopped
  #   ports:
  #     - "6379:6379"
  #   volumes:
  #     - redis_data:/data
  #   networks:
  #     - evoting-network

networks:
  evoting-network:
    driver: bridge

volumes:
  postgres_data:
  redis_data: