version: "3.9"
services:
  backend:
    env_file:
      - ./backend/.env
    build: ./backend
    ports:
      - "8000:8000"
    volumes:
      - ./backend:/app
    depends_on:
      - redis
    command: daphne -b 0.0.0.0 -p 8000 vontor_cz.asgi:application

  frontend:
    env_file:
      - ./frontend/.env
    build: ./frontend
    ports:
      - "5173:5173"
    volumes:
      - ./frontend:/app
    command: npm run dev

  redis:
    image: redis:alpine
    ports:
      - "6379:6379"

  db:
    env_file:
      - ./backend/.env
    image: postgres:16
    environment:
      POSTGRES_DB: mydb
      POSTGRES_USER: myuser
      POSTGRES_PASSWORD: mypassword
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data: