services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    command: sh -c "npm install && npm run dev"
    ports:
      - "3005:3000"
      - "4005:4005"
    environment:
      NODE_ENV: development
      API_PORT: 4005
      API_BASE_URL: http://localhost:4005
      NEXT_PUBLIC_API_BASE_URL: http://localhost:4005
      DATABASE_URL: postgres://postgres:postgres@localhost:5433/claudia_blog
      CORS_ORIGINS: http://localhost:3005
      WATCHPACK_POLLING: "true"
    volumes:
      - .:/app
      - node_modules:/app/node_modules
      - uploads:/app/public/uploads
    depends_on:
      - postgres
    working_dir: /app
    tty: true
    stdin_open: true

  postgres:
    image: postgres:latest
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: claudia_blog
    ports:
      - "5433:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  node_modules:
  postgres_data:
  uploads:


