services:
  postgres:
    image: postgres:16
    environment:
      POSTGRES_DB: pricewatch
      POSTGRES_USER: pricewatch
      POSTGRES_PASSWORD: pricewatch
      TZ: Europe/Paris
    ports:
      - "5432:5432"
    volumes:
      - pricewatch_pgdata:/var/lib/postgresql/data

  redis:
    image: redis:7
    environment:
      TZ: Europe/Paris
    ports:
      - "6379:6379"
    volumes:
      - pricewatch_redisdata:/data

  api:
    build: .
    ports:
      - "8001:8000"
    env_file:
      - .env
    environment:
      PW_DB_HOST: postgres
      PW_REDIS_HOST: redis
      TZ: Europe/Paris
    depends_on:
      - postgres
      - redis

  frontend:
    build: ./webui
    ports:
      - "3000:80"
    environment:
      TZ: Europe/Paris
      VITE_API_TOKEN: ${API_TOKEN:-}
    env_file:
      - .env
    depends_on:
      - api

  analytics-ui:
    build: ./analytics-ui
    ports:
      - "8070:80"
    environment:
      TZ: Europe/Paris
      PW_DB_HOST: postgres
      PW_DB_PORT: 5432
      PW_DB_NAME: pricewatch
      PW_DB_USER: pricewatch
      PW_DB_PASSWORD: pricewatch
      PW_REDIS_HOST: redis
      PW_REDIS_PORT: 6379
      PW_REDIS_DB: 0
    env_file:
      - .env
    depends_on:
      - postgres
      - redis

  adminer:
    image: adminer
    ports:
      - "8071:8080"
    environment:
      TZ: Europe/Paris
    depends_on:
      - postgres

volumes:
  pricewatch_pgdata:
  pricewatch_redisdata:
