############################################################################### # Dockerfile to create a ready-to-use Cypress Docker image for end-to-end # testing. # # This Dockerfile is based on the Dockerfile using Node.js 16.14.2 and # Cypress 10.3.0 # (https://github.com/cypress-io/cypress-docker-images/blob/master/included/10.3.0/Dockerfile) # from Cypress.io Docker images. ############################################################################### FROM cypress/browsers:node16.14.2-slim-chrome100-ff99-edge # avoid too many progress messages # https://github.com/cypress-io/cypress/issues/1243 ENV CI=1 \ # disable shared memory X11 affecting Cypress v4 and Chrome # https://github.com/cypress-io/cypress-docker-images/issues/270 QT_X11_NO_MITSHM=1 \ _X11_NO_MITSHM=1 \ _MITSHM=0 \ # point Cypress at the /root/cache no matter what user account is used # see https://on.cypress.io/caching CYPRESS_CACHE_FOLDER=/root/.cache/Cypress \ # Allow projects to reference globally installed cypress NODE_PATH=/usr/local/lib/node_modules # should be root user RUN echo "whoami: $(whoami)" \ && npm config -g set user $(whoami) \ # command "id" should print: # uid=0(root) gid=0(root) groups=0(root) # which means the current user is root && id \ && npm install -g "cypress@10.3.0" \ && cypress verify \ # Cypress cache and installed version # should be in the root user's home folder && cypress cache path \ && cypress cache list \ && cypress info \ && cypress version \ # give every user read access to the "/root" folder where the binary is cached # we really only need to worry about the top folder, fortunately && ls -la /root \ && chmod 755 /root \ # always grab the latest Yarn # otherwise the base image might have old versions # NPM does not need to be installed as it is already included with Node. && npm i -g yarn@latest \ # Show where Node loads required modules from && node -p 'module.paths' \ # should print Cypress version # plus Electron and bundled Node versions && cypress version \ && echo " node version: $(node -v) \n" \ "npm version: $(npm -v) \n" \ "yarn version: $(yarn -v) \n" \ "debian version: $(cat /etc/debian_version) \n" \ "user: $(whoami) \n" \ "chrome: $(google-chrome --version || true) \n" \ "firefox: $(firefox --version || true) \n" WORKDIR /tests COPY tests/ /tests # ENTRYPOINT ["cypress", "run"]