name: invio-dev

services:
  backend:
    build: ./backend  # Build from local backend/ directory
    shm_size: '256mb'
    env_file:
      - .env
    environment:
      ADMIN_USER: ${ADMIN_USER}
      ADMIN_PASS: ${ADMIN_PASS}
      JWT_SECRET: ${JWT_SECRET}
      DATABASE_PATH: ${DATABASE_PATH:-/app/data/invio.db}
    volumes:
      - invio_data:/app/data
      - ./backend:/app  # Mount source for live changes (if supported by your backend setup)
    ports:
      - "${BACKEND_PORT:-3000}:3000"
    restart: unless-stopped

  frontend:
    build: ./frontend  # Build from local frontend/ directory
    env_file:
      - .env
    environment:
      PORT: ${FRONTEND_PORT_INTERNAL:-8000}
      BACKEND_URL: ${BACKEND_URL:-http://backend:3000}
    depends_on:
      - backend
    volumes:
      - ./frontend:/app  # Mount source for live changes
      - ./VERSION:/app/VERSION  # Mount VERSION file into the container at /app/VERSION
    ports:
      - "${FRONTEND_PORT:-8000}:${FRONTEND_PORT_INTERNAL:-8000}"
    restart: unless-stopped
    # Use Fresh 2.x dev mode (Vite-based)
    command: ["sh", "-c", "deno task dev"]

volumes:
  invio_data:
    driver: local