I purchased a front/rear dashboard camera online. The camera is powered by USB and it has a small separate rear-view lens that I mounted in the back. both cameras record constantly and are powered by USB-C. I accomplished this with a small 10K powerpack I got on sale.
The camera itself didn't have a bike attachment, so I purchased one of those sets of various adapters to mount it. I ran the USB cable and the rear-view camera cable through the same bundle and in-frame bike battery pack compartment with the other wires and cables. The rear camera is attached to my rear basket with included double-sided tape. The powerpack sits inside an inexpensive plastic case in the rear basket using two magnets to keep it and the case from moving.
The who thing cost me about $100. The battery pack will last for hours even with the camera display on and probably much longer with the display off (It will keep recording). Although the bike battery has a USB port, I decided not to use that battery for anything but necessary assistance. When I shut off my bike for long periods, I unplug the cable from the powerpack but for short stops, I leave it on.