version: "3"

services:
  kutt:
    build: .
    depends_on:
      - postgres
      - redis
    volumes:
      - .:/usr/src/app  # Mount the source code for development
      - /usr/src/app/node_modules  # Use node_modules from inside the container
    ports:
      - "3400:3400"
    env_file:
      - .env  
    environment:
      NODE_ENV: production
      DB_NAME: kutt
      DB_HOST: postgres
      DB_USER: 298haoifa
      DB_PASSWORD: jaid98asdi
      REDIS_HOST: redis
    command: npm run start  # Assuming this starts your app in a development mode with hot reloading
  redis:
    image: redis:6.0-alpine
    volumes:
      - redis_data:/data
  postgres: # comment these out if using postgres outside of docker
    image: postgres:12-alpine
    environment:
      POSTGRES_USER: 298haoifa
      POSTGRES_PASSWORD: jaid98asdi
      POSTGRES_DB: kutt
    volumes:
      - postgres_data:/var/lib/docker-postgres-kutt/data
volumes:
  redis_data:
  postgres_data:
