# GnommoEditor — development
# Requires gu_common to be running (provides gnommo-db and gnommo-minio).
# Usage: docker compose up

services:
  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: gnommoeditor-backend
    restart: unless-stopped
    # Mount source so changes are picked up by --watch without rebuilding.
    # node_modules stay in the container image (not mounted).
    volumes:
      - ./backend/src:/app/src
      - ./backend/migrations:/app/migrations
    command: npm run dev
    environment:
      DATABASE_URL: postgresql://${POSTGRES_USER:-gnommo}:${POSTGRES_PASSWORD:-gnommo_secret}@gnommo_db:5432/gnommoeditor?sslmode=disable
      INGEST_API_KEY: ${INGEST_API_KEY:-dev-ingest-key-change-me}
      JWT_SECRET: ${JWT_SECRET:-dev-jwt-secret-change-me}
      CORS_ORIGIN: http://localhost:5173
      PORT: 3001
      MINIO_ENDPOINT: http://gnommo-minio:9000
      MINIO_PUBLIC_URL: http://localhost:9000
      MINIO_BUCKET: glitch-university
      MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
      MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
    ports:
      - "3001:3001"
    networks:
      - default
      - gnommo

networks:
  gnommo:
    external: true
