cypress-docker-images
cypress-docker-images copied to clipboard
Increase default shm_size
Fixes #308
The default shared memory size for docker is 64M, this increases it to 512M.
What is a good default size?
In a few places it appears to be 2GB that is the recommendation for browser testing
- https://lightrun.com/answers/cypress-io-cypress-cypress-hangs-during-execution-of-test-suite
- https://datawookie.dev/blog/2021/11/shared-memory-docker/
It appears that many cypress users have benefited from 512M https://github.com/cypress-io/cypress-docker-images/issues/308 and https://github.com/cypress-io/cypress/issues/350#issuecomment-353572782 so I went with a smaller value.
How this was tested
$ docker build --shm-size 512M -t cypress/browsers:node18.6.0-chrome105-ff104 --platform linux/amd64 .Sending build context to Docker daemon 8.704kB
Step 1/14 : FROM cypress/base:18.6.0
---> d36ac569f3bb
Step 2/14 : USER root
---> Using cache
---> 4ebfdf933e8f
Step 3/14 : RUN node --version
---> Using cache
---> c5209c17c5c7
Step 4/14 : COPY ./global-profile.sh /tmp/global-profile.sh
---> Using cache
---> 091f9c18af47
Step 5/14 : RUN cat /tmp/global-profile.sh >> /etc/bash.bashrc && rm /tmp/global-profile.sh
---> Using cache
---> f015c1b6becd
Step 6/14 : RUN apt-get update && apt-get install -y fonts-liberation git libcurl4 libcurl3-gnutls libcurl3-nss xdg-utils wget curl bzip2 mplayer && rm -rf /var/lib/apt/lists/* && apt-get clean
---> Using cache
---> 7e3ae4df58db
Step 7/14 : RUN wget --no-verbose /usr/src/libappindicator3-1_0.4.92-7_amd64.deb "http://ftp.us.debian.org/debian/pool/main/liba/libappindicator/libappindicator3-1_0.4.92-7_amd64.deb" && dpkg -i /usr/src/libappindicator3-1_0.4.92-7_amd64.deb ; apt-get install -f -y && rm -f /usr/src/libappindicator3-1_0.4.92-7_amd64.deb
---> Using cache
---> 138e60199a89
Step 8/14 : RUN node -p "process.arch === 'arm64' ? 'Not downloading Chrome since we are on arm64: https://crbug.com/677140' : process.exit(1)" || (wget --no-verbose -O /usr/src/google-chrome-stable_current_amd64.deb "http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_105.0.5195.102-1_amd64.deb" && dpkg -i /usr/src/google-chrome-stable_current_amd64.deb ; apt-get install -f -y && rm -f /usr/src/google-chrome-stable_current_amd64.deb)
---> Using cache
---> b7a4317b895f
Step 9/14 : ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
---> Using cache
---> 5d9fe0821324
Step 10/14 : RUN node -p "process.arch === 'arm64' ? 'Not downloading Firefox since we are on arm64: https://bugzilla.mozilla.org/show_bug.cgi?id=1678342' : process.exit(1)" || (wget --no-verbose -O /tmp/firefox.tar.bz2 https://download-installer.cdn.mozilla.net/pub/firefox/releases/104.0.1/linux-x86_64/en-US/firefox-104.0.1.tar.bz2 && tar -C /opt -xjf /tmp/firefox.tar.bz2 && rm /tmp/firefox.tar.bz2 && ln -fs /opt/firefox/firefox /usr/bin/firefox)
---> Using cache
---> b15d3a995118
Step 11/14 : RUN echo " node version: $(node -v) \n" "npm version: $(npm -v) \n" "yarn version: $(yarn -v) \n" "debian version: $(cat /etc/debian_version) \n" "Chrome version: $(google-chrome --version) \n" "Firefox version: $(firefox --version) \n" "Edge version: n/a \n" "git version: $(git --version) \n" "whoami: $(whoami) \n"
---> Using cache
---> 99009d673cf9
Step 12/14 : ENV TERM=xterm
---> Using cache
---> 6b76ff4ee3ea
Step 13/14 : ENV npm_config_loglevel=warn
---> Using cache
---> a8d6fe592c93
Step 14/14 : ENV npm_config_unsafe_perm=true
---> Using cache
---> 8ca1e6372cb1
Successfully built 8ca1e6372cb1
Successfully tagged cypress/browsers:node18.6.0-chrome105-ff104
@cesine is this ready for review or still a draft PR?
Still a draft. When I tested it, i didn't find it was working.
We worked around this by refactoring the tests that were longer than 4minutes.
We can close this pr, it seem that we've resolved shm usage in another way.
In 7.0.1, Cypress passes disable-dev-shm-usage to Chrome and Electron on startup, which should remove the need to use --ipc=host or increase the /dev/shm size. Once it's released this should be solved.
see this comment: https://github.com/cypress-io/cypress/issues/350#issuecomment-814959972