version: '3.8'

services:
  backend:
    build:
      context: ./packages/backend/claudable
      dockerfile: Dockerfile
    ports:
      - "3001:3001"
      - "8080:8080"
    environment:
      - NODE_ENV=production
      - PORT=3001
      - WS_PORT=8080
    volumes:
      - ./workspace:/app/workspace
    networks:
      - cursor-network
    restart: unless-stopped

  frontend:
    build:
      context: ./packages/frontend/cursor-web
      dockerfile: Dockerfile
    ports:
      - "5173:5173"
    environment:
      - VITE_BACKEND_URL=http://localhost:3001
      - VITE_WS_URL=ws://localhost:8080
    depends_on:
      - backend
    networks:
      - cursor-network
    restart: unless-stopped

  code-server:
    image: codercom/code-server:latest
    ports:
      - "8081:8080"
    environment:
      - PASSWORD=cursor123
    volumes:
      - ./workspace:/home/coder/workspace
    command: --bind-addr 0.0.0.0:8080 --auth password --disable-telemetry
    networks:
      - cursor-network
    restart: unless-stopped

  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./ssl:/etc/nginx/ssl
    depends_on:
      - frontend
      - backend
      - code-server
    networks:
      - cursor-network
    restart: unless-stopped

networks:
  cursor-network:
    driver: bridge

volumes:
  workspace: