# Development Environment
# Usage: docker compose -f docker/dev/docker-compose.yml up -d
# Or use: ./dev.sh

services:
  frontend-dev:
    container_name: image-uploader-frontend-dev
    user: root
    build:
      context: ../../
      dockerfile: docker/dev/frontend/Dockerfile
    working_dir: /app
    ports:
      - "3000:80"
    volumes:
      - ../../frontend:/app:cached
      - dev_frontend_node_modules:/app/node_modules
    environment:
      - CHOKIDAR_USEPOLLING=true
      - API_URL=http://backend-dev:5000
      - CLIENT_URL=http://localhost:3000
    depends_on:
      - backend-dev
    networks:
      - dev-internal

  backend-dev:
    container_name: image-uploader-backend-dev
    build:
      context: ../../
      dockerfile: docker/dev/backend/Dockerfile
    working_dir: /usr/src/app
    ports:
      - "5001:5000"
    volumes:
      - ../../backend:/usr/src/app:cached
      - dev_backend_node_modules:/usr/src/app/node_modules
    environment:
      - NODE_ENV=development
    networks:
      - dev-internal
    command: [ "npm", "run", "server" ]

networks:
  dev-internal:
    driver: bridge

volumes:
  dev_frontend_node_modules:
    driver: local
  dev_backend_node_modules:
    driver: local