This Dockerfile is inspired by cypress-io/cypress-docker-images#431 (comment) but stripped down to the bare minium to run Cypress inside Electron.
export CY_VERSION=9.4.1
docker build -t "cypress/m1:${CY_VERSION}" --build-arg VERSION=${CY_VERSION} .
export CY_VERSION=9.4.1
docker run -it -v $PWD:/e2e -w /e2e cypress/m1:${CY_VERSION}