volumes:
  wygiwyh_dev_postgres_data: {}
  wygiwyh_temp:


services:
  web:
    build:
      context: .
      dockerfile: ./docker/dev/django/Dockerfile
    image: wygiwyh_dev_server
    container_name: wygiwyh_dev_server
    volumes:
      - ./app/:/usr/src/app/:z
      - ./frontend/:/usr/src/frontend:z
      - wygiwyh_temp:/usr/src/app/temp/
    ports:
      - "${OUTBOUND_PORT:-8000}:${INTERNAL_PORT:-8000}"
    env_file:
      - .env
    depends_on:
      - db
      - vite
    restart: unless-stopped

  vite:
    build:
      context: .
      dockerfile: ./docker/dev/vite/Dockerfile
    image: wygiwyh_dev_node
    container_name: wygiwyh_dev_node
    volumes:
      - ./frontend/:/usr/src/frontend
      - ./app/:/usr/src/app/
      # http://jdlm.info/articles/2016/03/06/lessons-building-node-app-docker.html
      - /usr/src/frontend/node_modules
    ports:
      - '${WEBPACK_OUTBOUND_PORT}:5173'
    environment:
      - WATCHPACK_POLLING=true
    restart: unless-stopped

  db:
    image: postgres:15
    container_name: ${SQL_HOST}
    volumes:
      - wygiwyh_dev_postgres_data:/var/lib/postgresql/data/
    environment:
      - POSTGRES_USER=${SQL_USER}
      - POSTGRES_PASSWORD=${SQL_PASSWORD}
      - POSTGRES_DB=${SQL_DATABASE}
    ports:
      - '${SQL_PORT}:5432'
    restart: unless-stopped
