services:
  app:
    build:
      context: .
      dockerfile: build/Dockerfile
    container_name: pp-planer-app
    restart: unless-stopped
    working_dir: /app
    environment:
      - WWWUSER=${WWWUSER:-1000}
      - WWWGROUP=${WWWGROUP:-1000}
      - APP_ENV=${APP_ENV}
      - APP_DEBUG=${APP_DEBUG}
      - APP_KEY=${APP_KEY}
      - APP_URL=${APP_URL}
      - DB_CONNECTION=${DB_CONNECTION}
      - CTS_API_URL=${CTS_API_URL}
      - CTS_API_TOKEN=${CTS_API_TOKEN}
      - CHURCHTOOLS_URL=${CHURCHTOOLS_URL}
      - CHURCHTOOLS_CLIENT_ID=${CHURCHTOOLS_CLIENT_ID}
      - CHURCHTOOLS_CLIENT_SECRET=${CHURCHTOOLS_CLIENT_SECRET}
      - CHURCHTOOLS_REDIRECT_URI=${CHURCHTOOLS_REDIRECT_URI}
    volumes:
      - ./:/app
      - /app/node_modules
      - /app/vendor
    expose:
      - "9000"
    networks:
      - caddy
      - internal

  node:
    image: node:20-alpine
    container_name: pp-planer-node
    restart: unless-stopped
    working_dir: /app
    environment:
      - NODE_ENV=development
    volumes:
      - ./:/app
      - /app/node_modules
    expose:
      - "5173"
    networks:
      - caddy
      - internal
    command: sh -c "npm install && npm run dev"

  # mysql:
  #   image: mysql:8.0
  #   container_name: pp-planer-mysql
  #   restart: unless-stopped
  #   environment:
  #     MYSQL_DATABASE: ${DB_DATABASE}
  #     MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
  #     MYSQL_PASSWORD: ${DB_PASSWORD}
  #     MYSQL_USER: ${DB_USERNAME}
  #   volumes:
  #     - mysql_data:/var/lib/mysql
  #   networks:
  #     - internal

networks:
  caddy:
    external: true
  internal:
    driver: bridge
